可恢复的异常:任何现实生活场景?

Resumable exceptions: any real-life scenario?

正如主题所述,我很难想象在现实生活中的示例中何时何地使用可恢复异常,以及我们可能通过使用它们获得哪些有效优势。

我能想象的是,一个子系统已连接,比方说通过 RFC 连接到一个会话,该会话保持打开状态。子系统必须将一些 shopflor 数据传递给 sap,比方说,以通常的方式,以任何 weight/piece/liter 的频率处理。

不知何故失败了。

我可以在不使用可恢复异常的情况下完成所有这些,因此,除了这个异常似乎跟踪整个上下文(这似乎不是新功能)之外,还有人有吗?一个线索,这到底是怎么一回事?

不可恢复的异常是一种错误"Something went wrong here, and I can't continue running the program as desired any more. TILT."调用者只需要处理它。

可恢复的异常仍然会告诉调用者出现了问题,但它会推迟决定是否可以让调用者继续执行程序。我希望只有少数情况下这可能有用。批量更新可能是一种情况:"You wanted me to update both the material price and the text; I've changed the price, but the text in language ZH doesn't exist. I don't know whether you'd like to abort the operation entirely (RETURN) or keep the updated price and disregard the missing text (RESUME)."