什么是异常传播? [英] what is exception propagation?

查看:177
本文介绍了什么是异常传播?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


什么是异常传播

我在google上尝试过但对结果不满意。如有可能,请另附一些例子。 C ++,php和java语言比较好。

I tried in google but not satisfied with result . Please also explain with some example if possible . C++ , php and java language preferable .

推荐答案

令人惊讶的是,在关于异常的Java教程页面

异常从方法传播到方法,调用堆栈,直到它被捕获。因此,如果 a()调用 b(),调用 c(),调用 d(),如果 d()引发异常,则异常将传播从d到c到b到a,除非这些方法之一捕获异常。

An exception propagates from method to method, up the call stack, until it's caught. So if a() calls b(), which calls c(), which calls d(), and if d() throws an exception, the exception will propagate from d to c to b to a, unless one of these methods catches the exception.

这篇关于什么是异常传播?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆