flow-development-collection icon indicating copy to clipboard operation
flow-development-collection copied to clipboard

Better exception message output with code snippet line of thrown error.

Open mhsdesign opened this issue 2 years ago • 1 comments

I think it would be helpful to show additionally to the stack trace the code line which caused the error.

fx. when calling a method on null, the stack trace will only show the call to the method, where the error will be thrown, but I think it's also helpful to use the line and filename of the exception to show the snippet where the exception occurs.

image

I could imagine instead of using Debugger::getCodeSnippet creating Debugger::getCodeSnippetWithoutFileInfos or something (since getCodeSnippet will render the file names too)

Alternatively, it could also make sense adding the code snipped on top of the stack trace.

(note to myself: make sure this work correctly with nested exceptions)

what do you think?

mhsdesign avatar Dec 17 '21 19:12 mhsdesign

The more concrete error messages and exceptions while developing, I'm total in favor of that 🤗

sorenmalling avatar Dec 22 '21 12:12 sorenmalling