Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions aip/general/0193/aip.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ than being expected to constantly add verbose error handling everywhere.

Services **must** clearly distinguish successful responses from error responses
by using appropriate HTTP codes:
- Informational responses **must** use HTTP status codes between 100 and 199.
- Successful responses **must** use HTTP status codes between 200 and 399.
- Informational responses issued on a provisional basis while request processing continues **must** use HTTP status codes between 100 and 199.
- Successful responses **must** use HTTP status codes between 200 and 299.
- HTTP status codes between 300 and 399 **must** be used to indicate further action like URL redirection needs to be taken in order to complete the request.
- Errors indicating a problem with the user's request **must** use HTTP status
codes between 400 and 499.
- Errors indicating a problem with the server's handling of an valid request
Expand All @@ -37,15 +38,17 @@ interface Error {
// A unique identifier that identifies the specific occurrence of the problem. Can be provided to the API owner for debugging purposes.
id?: string
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id?: string instead of instance?: string, format: uri-reference

  • More on “instance”:
    • When the "instance" URI is dereferenceable, the problem details object can be fetched from it. It might also return information about the problem occurrence in other formats through use of proactive content negotiation (see [HTTP], Section 12.5.1).
    • When the "instance" URI is not dereferencable, it serves as a unique identifier for the problem occurrence that may be of significance to the server, but is opaque to the client.
  • Practical use cases of returning additional problem details for a specific occurrence through a URL seem limited.
  • To represent a unique identifier for an error, while being compliant with RFC 7807, an alternative name could be “id” (Example usage: Apple, Facebook)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternate options:

  • errorInstanceId
  • traceId
  • requestId
  • occurrenceId

Consensus was to use occurrenceId. id, errorId could be confused as an id unique for this error type instead of the specific occurrence. `


// An array of additional error details. errors?: any[]
// A map of metadata returning additional error details that can be used programmatically
metadata?: dict<string, any>
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The schema of metadata should be documented and a change in this schema could mean a breaking change.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shwoodard: The schema of metadata should be fixed per type and a change in this schema could mean a breaking change.

}


- The `title` field is intended for consumption by humans, and therefore
**may** change, even within a single version.
- The `code` field is intended to have code written against it, and therefore
**must not** change. Values for this field should be 0-63 characters, and use
only lower-case letters, numbers, and the `-` character.
only lower-case letters, numbers, and the `-` character. These strings should
be comparable using ordinal comparisons.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean? What kind of "ordinal comparisons", and for what purpose?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added "ordinal comparison" here per @jskeet's feedback: #45 (comment)

What that would mean here is each a developer should send stable error codes that can always be compared to the exact same numeric character values. For example, an API shouldn't send invalid_auth sometimes and Invalid_Auth other times.

That said, given we're recommending developers to always send lower-case letters here. I'm curious if we need that anymore? @jskeet thoughts?

Comment thread
saurabhsahni marked this conversation as resolved.
Outdated



Expand Down