Closed fpirsch closed 6 months ago
22.3.1-rc3 still throws intances of custom Exception classes, not native Error
s
Hi @fpirsch, could you give us some examples of such errors please ?
Hi @Reivilo85k I was referring to FailResponseException.js
, NotFoundException.js
, OAuthProviderException.js
, UnauthorizedException.js
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.
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.