-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
[Tracking] Converting C++ errors to use internal/errors #18106
Comments
To avoid stepping on anyone's toes: I am working on those errors in |
@komawar a good way to start helping out on this front would be to
|
Also provide an example on how to use internal/errors to handle errors in C++. PR-URL: #18149 Refs: #18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Weijia Wang <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Also provide an example on how to use internal/errors to handle errors in C++. PR-URL: #18149 Refs: #18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Weijia Wang <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
PR-URL: #18348 Refs: #18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #18348 Refs: #18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #18348 Refs: #18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #18348 Refs: #18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #18348 Refs: #18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #18348 Refs: #18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #18348 Refs: #18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #18348 Refs: #18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: #18871 Refs: #18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: #18871 Refs: #18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: #18871 Refs: #18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: #18871 Refs: #18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: #18871 Refs: #18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: #18871 Refs: #18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: #19268 Refs: #18106 Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: nodejs#18348 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#18348 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#18348 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#18348 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#18348 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#18348 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#18348 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#18348 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#18871 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: nodejs#18871 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: nodejs#18871 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: nodejs#18871 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: nodejs#18871 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: nodejs#18871 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: nodejs#18871 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: nodejs#18871 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: nodejs#18871 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: nodejs#18871 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
PR-URL: nodejs#18871 Refs: nodejs#18106 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
This isn't really a tracking issue, since there's no tracking happening. While it's true that we'd like to migrate as many C++ errors as possible/reasonable to use |
This is a tracking issue for the remaining bits of work around converting errors thrown in C++ land over to use internal/errors. There is still quite a bit here that needs to be done.
Currently, quite a few functions defined at the C++ layer and exposed through the
process.bindings()
perform input argument type checking at the C++ level and use some variation ofenv->ThrowTypeError()
to report the error back up to JavaScript. As much as possible, these should be modified to move the input argument type checking up into the JavaScript layer before the binding function is called, and the checks occurring at the C++ level should be changed into in appropriateCHECK()
statement. There are quite a few of these and it will be difficult to enumerate them all here. (Note also that this should include range checking)The general pattern for most functions is: Type check the inputs, perform some function, handle the result. In many cases, if the result is an error, some variation of
env->ThrowError()
is used to report the error back up to Javascript. As much as possible, these should be converted to return an error code back to JavaScript in some way then have the actualError
object generated within JavaScript.There are a few very rare cases where the C++ objects and functions are exposed directly to end users as public APIs. In these cases, we either need to introduce a JavaScript wrapper or we will have to add new internal C++
env->Throw
variants that accept an error code.Overall, the goal is to move as many of the Error creations into JavaScript as possible, then deal with the ones we absolutely cannot move separately.
/cc @mhdawson
The text was updated successfully, but these errors were encountered: