Skip to content

Throw and reject Promise with an Error#81

Merged
baelter merged 2 commits intocloudamqp:mainfrom
ngbrown-forks:feature/reject-error
Aug 23, 2023
Merged

Throw and reject Promise with an Error#81
baelter merged 2 commits intocloudamqp:mainfrom
ngbrown-forks:feature/reject-error

Conversation

@ngbrown
Copy link
Copy Markdown
Contributor

@ngbrown ngbrown commented Aug 9, 2023

It is considered good practice to only throw the Error object itself or an object using the Error object as base objects for user-defined exceptions and to pass instances of the built-in Error object to the reject() function for user-defined errors in Promises. The fundamental benefit of Error objects is that they automatically keep track of where they were built and originated.

This pull request enables the no-throw-literal and prefer-promise-reject-errors eslint rules and fixes the related issues.

@baelter baelter merged commit 6af6ade into cloudamqp:main Aug 23, 2023
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