| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2386fd5 commit 900c6c3
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -237,7 +237,8 @@ MaybeLocal<Value> cryptoErrorListToException( | |||
| 237 | 237 | if (errors.size() > 1) { | |
| 238 | 238 | CHECK(exception->IsObject()); | |
| 239 | 239 | Local<Object> exception_obj = exception.As<Object>(); | |
| 240 | - LocalVector<Value> stack(env->isolate(), errors.size() - 1); | ||
| 240 | + LocalVector<Value> stack(env->isolate()); | ||
| 241 | + stack.reserve(errors.size() - 1); | ||
| 241 | 242 | ||
| 242 | 243 | // Iterate over all but the last error in the list. | |
| 243 | 244 | auto current = errors.begin(); | |
@@ -255,9 +256,9 @@ MaybeLocal<Value> cryptoErrorListToException( | |||
| 255 | 256 | Local<v8::Array> stackArray = | |
| 256 | 257 | v8::Array::New(env->isolate(), stack.data(), stack.size()); | |
| 257 | 258 | ||
| 258 | - if (!exception_obj | ||
| 259 | - ->Set(env->context(), env->openssl_error_stack(), stackArray) | ||
| 260 | - .IsNothing()) { | ||
| 259 | + if (exception_obj | ||
| 260 | + ->Set(env->context(), env->openssl_error_stack(), stackArray) | ||
| 261 | + .IsNothing()) { | ||
| 261 | 262 | return {}; | |
| 262 | 263 | } | |
| 263 | 264 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,18 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + // This tests that the crypto error stack can be correctly converted. | ||
| 4 | + const common = require('../common'); | ||
| 5 | + if (!common.hasCrypto) | ||
| 6 | + common.skip('missing crypto'); | ||
| 7 | + | ||
| 8 | + const assert = require('assert'); | ||
| 9 | + const tls = require('tls'); | ||
| 10 | + | ||
| 11 | + assert.throws(() => { | ||
| 12 | + tls.createSecureContext({ clientCertEngine: 'x' }); | ||
| 13 | + }, (err) => { | ||
| 14 | + return err.name === 'Error' && | ||
| 15 | + /could not load the shared library/.test(err.message) && | ||
| 16 | + Array.isArray(err.opensslErrorStack) && | ||
| 17 | + err.opensslErrorStack.length > 0; | ||
| 18 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments