V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
stdying
V2EX  ›  Android

rxjava 中 onError,错误处理

  •  
  •   stdying · May 10, 2018 · 12949 views
    This topic created in 2914 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   ·   766 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 21:13 · PVG 05:13 · LAX 14:13 · JFK 17:13
    ♥ Do have faith in what you're doing.