| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a46bc45 commit dd4482e
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -112,6 +112,8 @@ const { | |||
| 112 | 112 | inspect: utilInspect, | |
| 113 | 113 | } = require('internal/util/inspect'); | |
| 114 | 114 | ||
| 115 | + const assert = require('internal/assert'); | ||
| 116 | + | ||
| 115 | 117 | const { | |
| 116 | 118 | codes: { | |
| 117 | 119 | ERR_BUFFER_OUT_OF_BOUNDS, | |
@@ -1389,9 +1391,9 @@ function atob(input) { | |||
| 1389 | 1391 | throw lazyDOMException( | |
| 1390 | 1392 | 'The string to be decoded is not correctly encoded.', | |
| 1391 | 1393 | 'InvalidCharacterError'); | |
| 1392 | - case -3: // Possible overflow | ||
| 1393 | - // TODO(@anonrig): Throw correct error in here. | ||
| 1394 | - throw lazyDOMException('The input causes overflow.', 'InvalidCharacterError'); | ||
| 1394 | + case -3: | ||
| 1395 | + assert.fail('Unrecognized simdutf error'); | ||
| 1396 | + break; | ||
| 1395 | 1397 | default: | |
| 1396 | 1398 | return result; | |
| 1397 | 1399 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1413,7 +1413,7 @@ static void Btoa(const FunctionCallbackInfo<Value>& args) { | |||
| 1413 | 1413 | // In case of error, a negative value is returned: | |
| 1414 | 1414 | // * -1 indicates a single character remained, | |
| 1415 | 1415 | // * -2 indicates an invalid character, | |
| 1416 | - // * -3 indicates a possible overflow (i.e., more than 2 GB output). | ||
| 1416 | + // * -3 indicates an unrecognized simdutf error. | ||
| 1417 | 1417 | static void Atob(const FunctionCallbackInfo<Value>& args) { | |
| 1418 | 1418 | CHECK_EQ(args.Length(), 1); | |
| 1419 | 1419 | Environment* env = Environment::GetCurrent(args); | |
@@ -1458,7 +1458,7 @@ static void Atob(const FunctionCallbackInfo<Value>& args) { | |||
| 1458 | 1458 | return args.GetReturnValue().Set(value); | |
| 1459 | 1459 | } | |
| 1460 | 1460 | ||
| 1461 | - // Default value is: "possible overflow" | ||
| 1461 | + // Default value is: "unrecognized simdutf error" | ||
| 1462 | 1462 | int32_t error_code = -3; | |
| 1463 | 1463 | ||
| 1464 | 1464 | if (result.error == simdutf::error_code::INVALID_BASE64_CHARACTER) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments