We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
prefer-error-cause
When throwing a new error in try/catch or Promise#catch, should add the old error as new error's cause property.
try/catch
Promise#catch
try {} catch { throw new Error('oops'); }
// (I'm not sure about this) try {} catch (error) { error.message = 'oops'; throw error; }
promise.catch(() => { throw new Error('oops'); })
// Same as above promise.then(null, () => { throw new Error('oops'); })
try {} catch (error) { throw new Error('oops', {cause: error}); }
promise.catch((error) => { throw new Error('oops', {cause: error}); })
The text was updated successfully, but these errors were encountered:
This is now accepted.
Sorry, something went wrong.
custom-error-definition
If anyone wants to work on this, see the initial attempt and feedback in #1793.
Successfully merging a pull request may close this issue.
When throwing a new error in
try/catch
orPromise#catch
, should add the old error as new error's cause property.Fail
Pass
The text was updated successfully, but these errors were encountered: