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

[Version 3] Throw exceptions instead of reject #79

Open
frederikbosch opened this issue Nov 16, 2018 · 0 comments
Open

[Version 3] Throw exceptions instead of reject #79

frederikbosch opened this issue Nov 16, 2018 · 0 comments

Comments

@frederikbosch
Copy link
Contributor

frederikbosch commented Nov 16, 2018

Quote by @sukima in #78.

The need to have an exception object is for the help of consumers to the addon. Once it hits the console there is a stack trace, There is a clear error message that developers can understand. And as an object a developer can easily catch the error and choose to deal with it (i.e. offer a friendly not found message translated correctly).

As for the difference between reject vs throw these are exactly the same thing. There is no difference. If you throw inside a then it is the same thing as returning a rejected promise. The difference is semantic and seeing a throw is more clear to those who are reading the code then a reject which doesn't stand out and (for me) would require a larger level of cognitive load then a language keyword like throw.

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

1 participant