为什么在onError函数中抛出错误时不会得到递归的无限循环? [英] Why don't I get a recursive infinite loop when throwing an error in the onError function?

查看:312
本文介绍了为什么在onError函数中抛出错误时不会得到递归的无限循环?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的coldfusion Application.cfc文件中,我定义一个onError函数。在某些情况下,我使用cfthrow标签明确地抛出异常。 < cfthrow object =#myException#> 。我的问题是,为什么不创建一个无限循环?或至少引起另一个调用onError函数? (相反,它只是将错误转储到屏幕上,实际上我想要的功能是什么:)但是我仍然对此为什么会感到困惑。)

解决方案

这是预期和记录的行为:



如果在处理onError方法时发生异常,或者onError方法使用cfthrow标签,则ColdFusion标准错误处理机制处理异常。 / a>


In my coldfusion Application.cfc file, I define an onError function. In certain situations, I explicitly throw an exception using a cfthrow tag - e.g. <cfthrow object="#myException#">. My question is, why doesn't this create an infinite loop? Or at least cause another call to the onError function? (Instead, it just dumps the error to the screen. Which is the functionality I want, actually :) - but I'm still confused about why this happens.)

解决方案

This is expected and documented behavior:

If an exception occurs while processing the onError method, or if the onError method uses a cfthrow tag, the ColdFusion standard error handling mechanisms handle the exception.

这篇关于为什么在onError函数中抛出错误时不会得到递归的无限循环?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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