Beginning outer try block, no exceptions yet
Beginning inner try block, no exceptions yet
Exception caught, beginning inner catch block
Error type: ReferenceError
Error message: undefinedVariable is not defined
Executing inner finally block
Exception caught, beginning outer catch block
Error type: ReferenceError
Error message: undefinedVariable is not defined
Executing outer finally block
嵌套例外处理的好处在于使我们能够很好地分阶段处理错误,内部例外处理可以负责解决由错误引发的脚本代码问题,外部例外处理则用于负责提供给用户的反馈信息或者对例外信息进行日志记录。