Skip to content

Conversation

@cre8
Copy link
Contributor

@cre8 cre8 commented Nov 25, 2025

Improvement to #332

  • rename exception to long form to make it clear
  • if a custom error instance is thrown, it will be wrapped. if it's a status list exception, it will be passed

Signed-off-by: Mirko Mollik [email protected]

cre8 added 2 commits November 25, 2025 08:40
Signed-off-by: Mirko Mollik <[email protected]>
Signed-off-by: Mirko Mollik <[email protected]>
@charsleysa
Copy link
Contributor

  • if a custom error instance is thrown, it will be passed. If not, it will be wrapped

By custom error instance, do you mean the StatusListException? If not, then the code is doing the opposite.

@cre8
Copy link
Contributor Author

cre8 commented Nov 25, 2025

  • if a custom error instance is thrown, it will be passed. If not, it will be wrapped

By custom error instance, do you mean the StatusListException? If not, then the code is doing the opposite.

Updated the description. I want to avoid the problem that you had: when the custom verify function is used, it needs to be wrapped to see if it was thrown during the status list verification.

If you want your custom message, it has to be of type statuslist exception

Copy link
Contributor

@TimoGlastra TimoGlastra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is better. One improvement I'd suggest is to always keep the original error. A common pattern is to have a cause property on the error, so you can get a trace of wrapped errors. It can make debugging quite hard otherwise.

You can implement the tostring method to include also the stack of the cause, so you see where the original error was thrown, and not just where it was wrapped.

@TimoGlastra
Copy link
Contributor

Erorr cause should be available in All modern browsers and Node.JS. I'm not sure about React Native.

We use a polyfill for it, but that was from 4 years ago, and it might not be needed anymore now.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause

@cre8
Copy link
Contributor Author

cre8 commented Nov 29, 2025

Erorr cause should be available in All modern browsers and Node.JS. I'm not sure about React Native.

We use a polyfill for it, but that was from 4 years ago, and it might not be needed anymore now.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause

Thanks for the useful resource, I update the extension classes to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants