| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a679669 commit a9fa2da
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1889,4 +1889,3 @@ E('ERR_WORKER_UNSERIALIZABLE_ERROR', | |||
| 1889 | 1889 | 'Serializing an uncaught exception failed', Error); | |
| 1890 | 1890 | E('ERR_WORKER_UNSUPPORTED_OPERATION', | |
| 1891 | 1891 | '%s is not supported in workers', TypeError); | |
| 1892 | - E('ERR_ZLIB_INITIALIZATION_FAILED', 'Initialization failed', Error); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,7 +42,6 @@ const { | |||
| 42 | 42 | ERR_BUFFER_TOO_LARGE, | |
| 43 | 43 | ERR_INVALID_ARG_TYPE, | |
| 44 | 44 | ERR_OUT_OF_RANGE, | |
| 45 | - ERR_ZLIB_INITIALIZATION_FAILED, | ||
| 46 | 45 | }, | |
| 47 | 46 | genericNodeError, | |
| 48 | 47 | } = require('internal/errors'); | |
@@ -815,14 +814,7 @@ function Brotli(opts, mode) { | |||
| 815 | 814 | new binding.BrotliDecoder(mode) : new binding.BrotliEncoder(mode); | |
| 816 | 815 | ||
| 817 | 816 | this._writeState = new Uint32Array(2); | |
| 818 | - // TODO(addaleax): Sometimes we generate better error codes in C++ land, | ||
| 819 | - // e.g. ERR_BROTLI_PARAM_SET_FAILED -- it's hard to access them with | ||
| 820 | - // the current bindings setup, though. | ||
| 821 | - if (!handle.init(brotliInitParamsArray, | ||
| 822 | - this._writeState, | ||
| 823 | - processCallback)) { | ||
| 824 | - throw new ERR_ZLIB_INITIALIZATION_FAILED(); | ||
| 825 | - } | ||
| 817 | + handle.init(brotliInitParamsArray, this._writeState, processCallback); | ||
| 826 | 818 | ||
| 827 | 819 | ReflectApply(ZlibBase, this, [opts, mode, handle, brotliDefaultOpts]); | |
| 828 | 820 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -108,6 +108,7 @@ void OOMErrorHandler(const char* location, const v8::OOMDetails& details); | |||
| 108 | 108 | V(ERR_VM_MODULE_CACHED_DATA_REJECTED, Error) \ | |
| 109 | 109 | V(ERR_VM_MODULE_LINK_FAILURE, Error) \ | |
| 110 | 110 | V(ERR_WASI_NOT_STARTED, Error) \ | |
| 111 | + V(ERR_ZLIB_INITIALIZATION_FAILED, Error) \ | ||
| 111 | 112 | V(ERR_WORKER_INIT_FAILED, Error) \ | |
| 112 | 113 | V(ERR_PROTO_ACCESS, Error) | |
| 113 | 114 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,6 +25,7 @@ | |||
| 25 | 25 | ||
| 26 | 26 | #include "async_wrap-inl.h" | |
| 27 | 27 | #include "env-inl.h" | |
| 28 | + #include "node_errors.h" | ||
| 28 | 29 | #include "node_external_reference.h" | |
| 29 | 30 | #include "threadpoolwork-inl.h" | |
| 30 | 31 | #include "util-inl.h" | |
@@ -271,6 +272,8 @@ class CompressionStream : public AsyncWrap, public ThreadPoolWork { | |||
| 271 | 272 | CHECK_EQ(unreported_allocations_, 0); | |
| 272 | 273 | } | |
| 273 | 274 | ||
| 275 | + Environment* env() const { return this->ThreadPoolWork::env(); } | ||
| 276 | + | ||
| 274 | 277 | void Close() { | |
| 275 | 278 | if (write_in_progress_) { | |
| 276 | 279 | pending_close_ = true; | |
@@ -694,7 +697,11 @@ class BrotliCompressionStream final : | |||
| 694 | 697 | static_cast<CompressionStream<CompressionContext>*>(wrap)); | |
| 695 | 698 | if (err.IsError()) { | |
| 696 | 699 | wrap->EmitError(err); | |
| 697 | - args.GetReturnValue().Set(false); | ||
| 700 | + // TODO(addaleax): Sometimes we generate better error codes in C++ land, | ||
| 701 | + // e.g. ERR_BROTLI_PARAM_SET_FAILED -- it's hard to access them with | ||
| 702 | + // the current bindings setup, though. | ||
| 703 | + THROW_ERR_ZLIB_INITIALIZATION_FAILED(wrap->env(), | ||
| 704 | + "Initialization failed"); | ||
| 698 | 705 | return; | |
| 699 | 706 | } | |
| 700 | 707 | ||
@@ -708,12 +715,11 @@ class BrotliCompressionStream final : | |||
| 708 | 715 | err = wrap->context()->SetParams(i, data[i]); | |
| 709 | 716 | if (err.IsError()) { | |
| 710 | 717 | wrap->EmitError(err); | |
| 711 | - args.GetReturnValue().Set(false); | ||
| 718 | + THROW_ERR_ZLIB_INITIALIZATION_FAILED(wrap->env(), | ||
| 719 | + "Initialization failed"); | ||
| 712 | 720 | return; | |
| 713 | 721 | } | |
| 714 | 722 | } | |
| 715 | - | ||
| 716 | - args.GetReturnValue().Set(true); | ||
| 717 | 723 | } | |
| 718 | 724 | ||
| 719 | 725 | static void Params(const FunctionCallbackInfo<Value>& args) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments