-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cactus-common): add createRuntimeErrorWithCause() & newRex() #1702
Comments
@m-courtin FYI: Here is a related issue #1129 and the PR corresponding to said issue that @Leeyoungone has been working on for some time: #1384 Also adding this issue to this epic because they are overlapping a bit: #1378 |
@petermetz Thanks for the ping and letting me know. Do you happen to have an example of
Do you happen to have any code examples that validate the |
@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 |
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce public getExceptionStack and getExceptionMessage functions with corresponding unit tests and include the new log-helper into api-server as usage example Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Fix update unit tests for generic exception handling to match new log helper returns Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
@Leeyoungone Yup, this is it: if (ex instanceof Error) {
// ex has .message and .stack
} |
@petermetz Ah cool cool! thank you :) |
Integrate custom exception handling and additionally integrate exception handling for nested / cascaded exceptions Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Extend the generic exception stack handling functionality to also analyze / process custom exceptions Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Adapt the unit tests to match to the extended exception stack handling Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Incorporate review comments and enhancing functional documentaion and applying new Exception-Helper functionality to api-server as demo for all other code Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Incorporate review comments and enhancing functional documentaion and applying new Exception-Helper functionality to api-server as demo for all other code Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Add detail documentaion to functionality newRuntimeError in exception-helper Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Fix getExceptionMessageInfo() function in exception-helper and add some documentation to logger.exception Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Introduce a log helper with static functions to get exception message / exception stack whatever is thrown or provided. Closes: hyperledger-cacti#1702 Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
Utility functions to conveniently re-throw excpetions typed as unknown by their catch block (which is the default since Typescript v4.4). Example usage can and much more documentation can be seen here: `packages/cactus-common/src/main/typescript/exception/create-runtime-error-with-cause.ts` and here `packages/cactus-common/src/test/typescript/unit/exception/create-runtime-error-with-cause.test.ts` Co-authored-by: Peter Somogyvari <peter.somogyvari@accenture.com> Closes: hyperledger-cacti#1702 [skip ci] Signed-off-by: Michael Courtin <michael.courtin@accenture.com> Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
Describe 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.The text was updated successfully, but these errors were encountered: