Skip to content
The style guide is in beta: content and structure may change.

Errors and exceptions

This page describes the rules for the errors section of an API reference page, which lists the errors, exceptions, and error codes that an API element can produce.

api-error-001 should API docs

List every error, exception, or error code that the element can produce, each with the condition that causes it and what the caller can do about it. Title the section with the name that the language or platform uses, such as Exceptions, Errors, Throws, or Error codes.

Examples

  • ✓ PermissionError: The caller lacks the contacts.read permission. Request the permission, then retry the call.
  • ✗ PermissionError: Thrown when there is a permission error.
  • ✓ 404 NOT_FOUND: No project has the specified ID. Check the ID against the project list.

Rationale

A reader who gets an error wants to recognize the cause in their own code and to know what to do next. The section title follows the language’s or platform’s convention because the reader’s stack trace or response body uses the same word.