worker: unify custom error creation · nodejs/node@18ecaeb · GitHub
Skip to content

Commit 18ecaeb

Browse files
committed
worker: unify custom error creation
Mostly, this introduces a pattern that makes sure that if a custom error is reported, `stopped_` will be set to `true` correctly in every cast, which was previously missing for the `NewContext().IsEmpty()` case (which led to a hard crash from the `Worker` destructor). This also leaves TODO comments for a few cases in which `ERR_WORKER_OUT_OF_MEMORY` was not used in accordance with the documentation for that error code (or according to its intention). Fixing that is semver-major. Backport-PR-URL: #35241 PR-URL: #33084 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 1066341 commit 18ecaeb

2 files changed

Lines changed: 22 additions & 15 deletions

File tree

src/node_worker.cc

Lines changed: 17 additions & 13 deletions

src/node_worker.h

Lines changed: 5 additions & 2 deletions

0 commit comments

Comments
 (0)