Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[squash] throw errors for crypto return
  • Loading branch information
addaleax committed May 1, 2017
commit 2ea112b8919d371f7d874e4382cecc436b37705b
16 changes: 10 additions & 6 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3816,9 +3816,11 @@ void Hmac::HmacDigest(const FunctionCallbackInfo<Value>& args) {
encoding,
&error);
delete[] md_value;
// TODO(addaleax): Throw `error` here. This isn't so terribly important,
// hashes are very short so creating the corresponding strings is very
// unlikely to fail.
if (rc.IsEmpty()) {
CHECK(!error.IsEmpty());
env->isolate()->ThrowException(error);
return;
}
args.GetReturnValue().Set(rc.ToLocalChecked());
}

Expand Down Expand Up @@ -3942,9 +3944,11 @@ void Hash::HashDigest(const FunctionCallbackInfo<Value>& args) {
md_len,
encoding,
&error);
// TODO(addaleax): Throw `error` here. This isn't so terribly important,
// hashes are very short so creating the corresponding strings is very
// unlikely to fail.
if (rc.IsEmpty()) {
CHECK(!error.IsEmpty());
env->isolate()->ThrowException(error);
return;
}
args.GetReturnValue().Set(rc.ToLocalChecked());
}

Expand Down