-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
crypto, errors: Add CryptoError to internal/errors, update crypto.setEngine #16529
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
Conversation
|
Ping @nodejs/tsc |
mcollina
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
Test is failing on windows... fixing now |
test/parallel/test-crypto-engine.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert.strictEqual(), and the line below
|
I'd like this to land after #16567 |
Allows setting an `additional` callback to perform additional checks on the given error object
A new internal/errors type that provides access to the `opensslErrorStack`, code, and message.
Update the `crypto.setEngine()` method to use the new internal/errors `CryptoError` mechanism rather than using `throwCryptoError()`
c654fda to
5fce91e
Compare
| // 'error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 err' | ||
| // ] | ||
| exception->Set(env->context(), env->openssl_error_stack(), error_stack) | ||
| context->Set(env->context(), env->openssl_error_stack(), error_stack) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be easier to understand if the context argument here is named exception or error, I thought this is a v8::Context at first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the one in CaptureCryptoStatus
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once #16567 lands I'll be refactoring this one a bit. Will make that change then.
|
@targos ... yes, I'll get this updated this week. |
|
@jasnell there is not much time left this week ;-) |
|
Heh. True. Will still try to get to it. |
|
Ping @jasnell |
|
Yep, haven't forgotten. :-) |
|
@jasnell ping again ;-) |
The way that
throwCryptoError()is currently defined withinsrc/node_crypto.ccmakes it rather difficult to refactor those errors to useinternal/errors. This provides an alternative and an example of it being used.There are three commits:
One that adds a new
additionalcallback check forcommon.expectsError()that provides the ability to perform additional checks on an errorOne that adds a new
errors.CryptoErrorto internal/errorsOne that finishing migrating the
crypto.setEngine()method to useerrors.CryptoError, illustrating how the revised mechanism for getting theopensslErrorStackandmessageproperties would work. The same pattern would be used for all instances ofthrowCryptoError()Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
crypto, errors