Skip to content

pass error when rejecting promise #1

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

redpandatronicsuk
Copy link

Now error can be used in catch block that handles the error

Now error can be used in catch block that handles the error
@msaaddev msaaddev self-requested a review September 28, 2021 16:58
@msaaddev
Copy link
Owner

msaaddev commented Sep 28, 2021

@redpandatronicsuk thanks for the PR. I see you are passing the error in the reject. If you take a look on the line before reject, you will see that I am using a function called handleError. This function actually extracts all the useful part of the error, format it, and then show it to the user. If we pass the error in reject as well, it is going to show a duplicate error if the user logs it in the catch. One formatted and the other non-formatted.

@msaaddev
Copy link
Owner

But I think your approach is better and is more general. Would you mind editing the PR and remove the handleError part as well as removing the dependency?

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.

2 participants