上一个报错,如何依次调用下一个swift combine publisher?

How to call the next swift combine publisher in turn if the previous one reported an error?

有 3 个发布者。首先你需要尝试第一个,如果出现错误,则使用第二个,如果再次错误,则使用第三个,如果失败,则return最后一个错误。重要提示:不能并行调用,必须按顺序调用。我假设应该使用 scan 方法,但我不明白具体如何。

Catch 允许您在发生上游错误时 return 发布者。一般来说,设置如下所示:

publisher1
   .catch { err1 in
      publisher2
   }
   .catch { err2 in
      publisher3
   }