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

Always throw Error objects #157

Open
deadbeef84 opened this issue Mar 18, 2021 · 0 comments
Open

Always throw Error objects #157

deadbeef84 opened this issue Mar 18, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@deadbeef84
Copy link

deadbeef84 commented Mar 18, 2021

I was bitten by a bug where I expected a thrown err.message to exist, but it didn't since this library is throwing response objects rather than Error objects.

It's good practice to always throw Error objects (or a subclass of). This also applies to EventEmitter.emit('error', err). If you want to give the user access to additional properties you can always add those as properties of the error object.

@rlueder rlueder added the enhancement New feature or request label Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants