Skip to content
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

Throwing errors and good practices #502

Closed
fpirsch opened this issue Nov 29, 2023 · 5 comments
Closed

Throwing errors and good practices #502

fpirsch opened this issue Nov 29, 2023 · 5 comments

Comments

@fpirsch
Copy link

fpirsch commented Nov 29, 2023

The lib throws custom objects instead of Error objects, so we don't have the stack trace and logging can't be standardized.
It is considered good practice to throw only instances of the Error class or its subclasses.

https://eslint.org/docs/latest/rules/no-throw-literal
https://rules.sonarsource.com/typescript/RSPEC-3696/

Custom exceptions should extend the native Error function.

@youssef-saber-3
Copy link
Contributor

Hey , we've updated error handling in the next beta version of the sdk ,as well as adding typescript support in this version. you can follow the guide here for setup and feel free to give feedback or report any issues you run into

@fpirsch
Copy link
Author

fpirsch commented Jan 26, 2024

22.3.1-rc3 still throws intances of custom Exception classes, not native Errors

@Reivilo85k
Copy link
Contributor

Hi @fpirsch, could you give us some examples of such errors please ?

@fpirsch
Copy link
Author

fpirsch commented Mar 12, 2024

Hi @Reivilo85k I was referring to FailResponseException.js, NotFoundException.js, OAuthProviderException.js, UnauthorizedException.js

@Reivilo85k
Copy link
Contributor

Hi @fpirsch ,

Thank you for your feedback. After careful consideration, we've decided to retain our current approach to custom exceptions as it aligns with our design goals. We appreciate your understanding and continued support.

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

No branches or pull requests

3 participants