| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
If you look at lib/internals/errors.js, you'll see that ERR_ARG_NOT_ITERABLE is already a TypeError.
Sorry, something went wrong.
There was a problem hiding this comment.
ERR_INVALID_TUPLE is already a TypeError
Sorry, something went wrong.
There was a problem hiding this comment.
It needs error.constructor equals to TypeError. So inheritance is not allowed.
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry, something went wrong.
There was a problem hiding this comment.
I would argue that's a bug in the test harness and not our implementation.
const e = new ERR_INVALID_TUPLE('a', 'b');
console.log(e instanceof TypeError); // trueThe spec text says only to throw a TypeError, and that is what we're doing here.
Sorry, something went wrong.
There was a problem hiding this comment.
our internal errors already satisfy this constraint:
> try { new URLSearchParams([1]) } catch(err) { console.log(err.constructor === TypeError) }
true
Sorry, something went wrong.
There was a problem hiding this comment.
2 ways to resolve it:
Both of the two ways are OK, but current code can't pass that case.
Sorry, something went wrong.
There was a problem hiding this comment.
It was fixed in #33857
Sorry, something went wrong.
There was a problem hiding this comment.
I'll take a look later.
Sorry, something went wrong.
There was a problem hiding this comment.
But new URLSearchParams(DOMException.prototype); is thrown by DOMException.
Sorry, something went wrong.
There was a problem hiding this comment.
@targos You're right. The only thing I should fix for error handling is the ERR_INVALID_THIS in lib/internal/per_context/domexception.js.
Sorry, something went wrong.
There was a problem hiding this comment.
This is not the correct way of handling this. If you take a look at lib/internals/errors.js, you'll see that some error codes have multiple types in their list... for instance ERR_INVALID_STATE lists Error, TypeError, and RangeError. To create an ERR_INVALID_STATE error this is a TypeError, you simply do new ERR_INVALID_STATE.TypeError("message")
Sorry, something went wrong.
There was a problem hiding this comment.
The TypeError handling in this is not correct. Haven't looked at the rest yet.
Sorry, something went wrong.
I've fixed them. |
Sorry, something went wrong.
|
@nodejs/url |
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
If we decided to add FormData later someone might miss removing this. It would be worthwhile making this replacement dependent on whether FormData is undefined.
Sorry, something went wrong.
There was a problem hiding this comment.
Done. I've add typeof FormData === 'undefined'.
Sorry, something went wrong.
There was a problem hiding this comment.
/ping @jasnell
Sorry, something went wrong.
There was a problem hiding this comment.
/ping @jasnell
Sorry, something went wrong.
According to WPT: 1. `URLSearchParams` constructor should throw exactly `TypeError` if any Error occurrs. 2. When a record passed to `URLSearchParams` constructor, two different key may result same after `toUVString()`. We should leave only the later one.
Sorry, something went wrong.
|
/ping @jasnell Could you please take a minute to review this PR again? Thanks. |
Sorry, something went wrong.
|
Hi @jasnell, would you please to review this PR again? |
Sorry, something went wrong.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
According to WPT:
Error occurrs.
key may result same after toUVString(). We should leave only the
later one.