fix: Exception / error handling directly accessing .stack and .message
See original GitHub issueDescribe the bug
In multiple places in the code within a catch block the .message
and .stack
is directly getting accessed without any checks. As possibly all things can be thrown in TypeScript / JavaScript (even undefined or null etc.) and not only Error objects. Therefore it needs to be validated first if .message
respective .stack
are existing before they are getting accessed. Furthermore a fallback should be implemented in case the thrown objects are no regular Error objects and not providing the requested properties or the stringify of the .stack
for example is failing due to hierarchy depth etc.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Error Handling - OWASP Cheat Sheet Series
We indicate to the handler, via the annotation @ExceptionHandler, to act when any exception extending the class java.lang.Exception is thrown by the application ......
Read more >Error Handling Flaws - Information and How to Fix - Veracode
In many cases, improper error handling is a result of using default error handlers. These messages may include detailed information about a file...
Read more >Thoughtful Error Handling - Medium
Consider standardizing your error messages with an error code. Ensure error messages provide enough information to resolve security incidents ...
Read more >Best Practices for exceptions - .NET - Microsoft Learn
Use exception handling if the event doesn't occur often, that is, if the event is truly exceptional and indicates an error, such as...
Read more >9 Best Practices to Handle Java Exceptions - Stackify
Exception handling is an error-handling mechanism. When something goes wrong, an exception is thrown. If you do nothing, the exception causes ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Leeyoungone Yup, this is it:
@petermetz: Thank you very much for the heads-up about the PR @Leeyoungone is working on. So I will only include the basic functionality into my PR that @Leeyoungone can use it in her PR