| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -655,7 +655,7 @@ static void ToUnicode(const FunctionCallbackInfo<Value>& args) { | |||
| 655 | 655 | int32_t len = ToUnicode(&buf, *val, val.length()); | |
| 656 | 656 | ||
| 657 | 657 | if (len < 0) { | |
| 658 | - return env->ThrowError("Cannot convert name to Unicode"); | ||
| 658 | + return THROW_ERR_INVALID_ARG_VALUE(env, "Cannot convert name to Unicode"); | ||
| 659 | 659 | } | |
| 660 | 660 | ||
| 661 | 661 | args.GetReturnValue().Set( | |
@@ -678,7 +678,7 @@ static void ToASCII(const FunctionCallbackInfo<Value>& args) { | |||
| 678 | 678 | int32_t len = ToASCII(&buf, *val, val.length(), mode); | |
| 679 | 679 | ||
| 680 | 680 | if (len < 0) { | |
| 681 | - return env->ThrowError("Cannot convert name to ASCII"); | ||
| 681 | + return THROW_ERR_INVALID_ARG_VALUE(env, "Cannot convert name to ASCII"); | ||
| 682 | 682 | } | |
| 683 | 683 | ||
| 684 | 684 | args.GetReturnValue().Set( | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,8 +33,6 @@ const wptToASCIITests = require( | |||
| 33 | 33 | } | |
| 34 | 34 | ||
| 35 | 35 | { | |
| 36 | - const errMessage = /^Error: Cannot convert name to ASCII$/; | ||
| 37 | - | ||
| 38 | 36 | for (const [i, test] of wptToASCIITests.entries()) { | |
| 39 | 37 | if (typeof test === 'string') | |
| 40 | 38 | continue; // skip comments | |
@@ -43,8 +41,14 @@ const wptToASCIITests = require( | |||
| 43 | 41 | if (comment) | |
| 44 | 42 | caseComment += ` (${comment})`; | |
| 45 | 43 | if (output === null) { | |
| 46 | - assert.throws(() => icu.toASCII(input), | ||
| 47 | - errMessage, `ToASCII ${caseComment}`); | ||
| 44 | + common.expectsError( | ||
| 45 | + () => icu.toASCII(input), | ||
| 46 | + { | ||
| 47 | + code: 'ERR_INVALID_ARG_VALUE', | ||
| 48 | + type: TypeError, | ||
| 49 | + message: 'Cannot convert name to ASCII' | ||
| 50 | + } | ||
| 51 | + ); | ||
| 48 | 52 | icu.toASCII(input, true); // Should not throw. | |
| 49 | 53 | } else { | |
| 50 | 54 | assert.strictEqual(icu.toASCII(input), output, `ToASCII ${caseComment}`); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments