Re: [whatwg/url] Named validation errors (#502)

@annevk commented on this pull request.

This is great, thanks for putting this together!

Yes to both your questions from me as well. I gave some initial feedback on some of the naming choices.

> @@ -85,6 +85,170 @@ valid input. User agents, especially conformance checkers, are encouraged to rep
  unclear to other developers.
 </div>
 
+<table>
+ <thead>
+  <tr>
+   <th>Error Code
+   <th>Error Message
+ <tbody>
+  <tr>
+   <td><dfn>unexpected-c0-control-or-space</dfn>
+   <td>This error occurs when the input to the URL parser contains leading or trailing

If we make the header "Description" as you suggest we could make this "The input to the URL parser ..." and not have the repeating introductory phrase.

> @@ -85,6 +85,170 @@ valid input. User agents, especially conformance checkers, are encouraged to rep
  unclear to other developers.
 </div>
 
+<table>
+ <thead>
+  <tr>
+   <th>Error Code
+   <th>Error Message
+ <tbody>
+  <tr>
+   <td><dfn>unexpected-c0-control-or-space</dfn>
+   <td>This error occurs when the input to the URL parser contains leading or trailing
+   <a>C0 control or space</a> code points. The URL parser subsequently strips any matching code
+   points.
+  <tr>
+   <td><dfn>unexpected-ascii-tab-or-newline</dfn>

I would prefer uppercasing ASCII here. Or is there a reason for all lowercase names? Similar for IPv4 and such.

> +   <td>This error occurs when no <a>scheme</a> is present and either no <a>base URL</a>
+   was provided or the <a>base URL</a> cannot be used as a <a>base URL</a>.
+  <tr>
+   <td><dfn>relative-url-missing-beginning-solidus</dfn>
+   <td>This error occurs when a <a>relative-URL String</a> is given that does not begin with a
+   U+002F (/) code point.
+  <tr>
+   <td><dfn>wrong-solidus-special-scheme</dfn>
+   <td>This error occurs when a URL with a <a>special scheme</a> uses the U+005C (\) reverse
+   solidus code point instead of the U+002F (/) code point.
+  <tr>
+   <td><dfn>missing-solidus-before-authority</dfn>
+   <td>This error occurs if the URL <a>includes credentials</a> and they are not preceeded by
+   two "<code>//</code>" U+002F (/) code points.
+  <tr>
+   <td><dfn>unexpected-@-code-point</dfn>

I think this should be commercial-at if we're not using / for solidus.

> +   <a>starts with a Windows drive letter</a> and the <a>base URL</a>'s <a>scheme</a> is
+   "<code>file</code>".
+  <tr>
+   <td><dfn>unexpected-windows-drive-letter-host</dfn>
+   <td>???
+  <tr>
+   <td><dfn>unexpected-host-file-scheme</dfn>
+   <td>This error occurs when the URL's <a>scheme</a> is changed to the "<code>file</code>"
+   <a>scheme</a> and the existing URL has a <a for=url>host</a>.
+  <tr>
+   <td><dfn>unexpected-empty-path</dfn>
+   <td>This error occurs when a URL with a "<code>file</code>" <a>scheme</a> contains an empty
+   <a>path</a>.
+  <tr>
+   <td><dfn>invalid-url-code-point</dfn>
+   <td>This error occurs when a code point that is not a <a>url code point</a> or U+0025 (%) in the

URL code point*

> +   <td>This error occurs when a URL with a "<code>file</code>" <a>scheme</a> contains an empty
+   <a>path</a>.
+  <tr>
+   <td><dfn>invalid-url-code-point</dfn>
+   <td>This error occurs when a code point that is not a <a>url code point</a> or U+0025 (%) in the
+   URL's <a>path</a>, <a>query</a>, or <a for=url>fragment</a>.
+  <tr>
+   <td><dfn>unescaped-percent-sign</dfn>
+   <td>This error occurs when a U+0025 (%) code point is found that is not followed by two
+   <a>ASCII hex digits</a>, representing a <a>percent-encoded byte</a>, in the URL's <a>path</a>,
+   <a>query</a>, or <a for=url>fragment</a>.
+  <tr>
+   <td><dfn>unclosed-ipv6-address</dfn>
+   <td>This error occurs when an IPv6 address is missing the closing U+005D (]) code point.
+  <tr>
+   <td><dfn>ascii-idn-failure</dfn>

There are more errors here now so you'll have to split this (and rebase). I suggest calling this after IDNA, ToASCII, or domain-to-ASCII and not add a new term (IDN).

> +   <a>query</a>, or <a for=url>fragment</a>.
+  <tr>
+   <td><dfn>unclosed-ipv6-address</dfn>
+   <td>This error occurs when an IPv6 address is missing the closing U+005D (]) code point.
+  <tr>
+   <td><dfn>ascii-idn-failure</dfn>
+   <td>This error occurs when transforming the domain to ASCII using IDN records an error.
+  <tr>
+   <td><dfn>host-forbidden-code-point</dfn>
+   <td>This error occurs when the host contains a <a>forbidden host code point</a>.
+  <tr>
+   <td><dfn>unexpected-non-decimal-number</dfn>
+   <td>This occurs when the IPv4 address contains numbers expressed using hexadecimal or octal
+   digits.
+  <tr>
+   <td><dfn>ipv4-octet-out-of-range</dfn>

Let's use part and not octet for IPv4 parts (throughout). This matches the parser variable naming.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/pull/502#pullrequestreview-408621362

Received on Saturday, 9 May 2020 07:30:41 UTC