{"record":{"id":"69ec640e4292f70e","repo":"cefsharp/CefSharp","slug":"nested-exception-canceled","errorCode":null,"errorMessage":"Nested Exception Canceled","messagePattern":"Nested Exception Canceled","errorType":"exception","errorClass":"OperationCanceledException","httpStatus":null,"severity":"info","filePath":"CefSharp.Example/JavascriptBinding/ExceptionTestBoundObject.cs","lineNumber":35,"sourceCode":"        }\n\n        [DebuggerStepThrough]\n        public double TriggerNestedExceptions()\n        {\n            try\n            {\n                try\n                {\n                    return DivisionByZero(0);\n                }\n                catch (Exception innerException)\n                {\n                    throw new InvalidOperationException(\"Nested Exception Invalid\", innerException);\n                }\n            }\n            catch (Exception e)\n            {\n                throw new OperationCanceledException(\"Nested Exception Canceled\", e);\n            }\n        }\n\n        [DebuggerStepThrough]\n        public int TriggerParameterException(int parameter)\n        {\n            return parameter;\n        }\n\n        public void TestCallbackException(IJavascriptCallback errorCallback, IJavascriptCallback errorCallbackResult)\n        {\n            const int taskDelay = 500;\n\n            Task.Run(async () =>\n            {\n                await Task.Delay(taskDelay);\n\n                using (errorCallback)","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/cefsharp/CefSharp/blob/16bc6e0711a4945be17e8bc4bc7ccf9469f3fdec/CefSharp.Example/JavascriptBinding/ExceptionTestBoundObject.cs#L17-L53","documentation":"The outermost OperationCanceledException thrown by TriggerNestedExceptions() wrapping the InvalidOperationException (which itself wraps the DivisionByZero). It tests that CefSharp correctly flattens/transmits a multi-level exception stack to JavaScript. Not a production error; purely demo/test code.","triggerScenarios":"Calling bound TriggerNestedExceptions() from JS in the example browser — this is the final exception that reaches the JS catch.","commonSituations":"Running the example app's exception-handling demo. Not encountered in production unless you reference ExceptionTestBoundObject.","solutions":["Expected in example code — not a real defect.","Remove the example bound object from your project if unwanted.","When designing your own bound objects, prefer a single well-typed exception over deeply nested ones."],"exampleFix":"// JavaScript\ntry { await boundObj.triggerNestedExceptions(); }\ncatch (e) { console.log('Outer:', e.message, 'Inner:', e.innerException); }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// In JavaScript\ntry { await boundObj.triggerNestedExceptions(); }\ncatch (e) { console.log('Outer:', e.message, 'Inner:', e.innerException); }","preventionTips":["Recognize as intentional outer-wrapper demo.","Avoid deeply nested exception wrapping in your own bound objects.","Inspect the inner chain for the real cause."],"tags":["example-code","js-binding","nested-exception","intentional"],"backgroundTag":null,"analyzedSha":"16bc6e0711a4945be17e8bc4bc7ccf9469f3fdec","analyzedAt":"2026-08-13T19:57:05.828Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}