stdying
V2EX  ›  Android

rxjava 中 onError,错误处理

  •  
  •   stdying · May 10, 2018 · 13016 views
    This topic created in 2931 days ago, the information mentioned may be changed or developed.
    Rxjava 中正常情况下 onNext 处理最后对象,假设为 student 类,现在中间出现异常调用 onError 接口,不过需要在 onError 中需要 student 类的部分信息,
    这个怎么处理,数据来源不是单个 student,而是一个数组集合 student,
    要怎么确定出现异常的是哪个 student,
    2 replies    2018-05-10 14:51:23 +08:00
    picy
        1
    picy  
       May 10, 2018   ❤️ 1
    包装一层自定义的异常,把当前的 student 对象带过去。
    stdying
        2
    stdying  
    OP
       May 10, 2018
    @janstk 对的,我后来也想起来,可以自定义异常,以前自定义异常用的比较少
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3635 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 53ms · UTC 10:24 · PVG 18:24 · LAX 03:24 · JFK 06:24
    ♥ Do have faith in what you're doing.