When throwing a new error in try/catch
or Promise#catch
, should add the old error as new error's cause property.
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});
})
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too