iso-error

An Isomorphic Error Library

Downloads
5.8K
Stars
3
Committers
6

Bot releases are visible (Hide)

iso-error - [email protected] Latest Release

Published by unional about 1 year ago

Patch Changes

iso-error - [email protected]

Published by unional about 1 year ago

Major Changes

  • 5bba9a9: Update filenames to add the error category.

    Add examples for the errors.

iso-error - [email protected]

Published by unional about 1 year ago

Patch Changes

iso-error - [email protected]

Published by unional about 1 year ago

Major Changes

  • c1efc1d: Flatten spec.

    The updated folder-based spec does not work well when used.
    It creates conflicting schema names between code/* and status/*.

    Also, the naming scheme of error~any-of and error=aborted create invalid key per OpenAPI spec.

    They are now replaced with -.
    Although it missed some meaning, that's a compromise need to be made.

iso-error - [email protected]

Published by unional about 1 year ago

Patch Changes

iso-error - [email protected]

Published by unional about 1 year ago

Patch Changes

  • b8eee47: Add missing oneOf entries for code and status.
iso-error - [email protected]

Published by unional about 1 year ago

Patch Changes

iso-error - [email protected]

Published by unional about 1 year ago

Minor Changes

  • 4feedbf: Adding folder based specs, with separated code/status/message/details so they can be reused separately.
iso-error - [email protected]

Published by unional about 1 year ago

Patch Changes

iso-error - [email protected]

Published by unional about 1 year ago

Minor Changes

  • ca2efb4: Add google_cloud_api.any-of.yaml for reuse.
    This is useful for some API that wants to keep the error generic,
    or before the details are flushed out.
iso-error - [email protected]

Published by unional about 1 year ago

Patch Changes

iso-error - [email protected]

Published by unional about 1 year ago

Major Changes

  • 13e7538: Add missing status in the data structure:

    {
      error: {
        code: number,
        status: string, // new
        message: string,
        details: Details[]
      }
    }
    

    This status is mentioned in the Google Cloud APIs documentation (example) but was not added before.

    Since this change adds a new required/expected field. This is a breaking change.

iso-error - [email protected]

Published by unional about 1 year ago

Major Changes

  • b394a73: google.rpc.Status should be wrapped inside an error field.

    According to Google Cloud API Errors > HTTP Mapping:

    // This message defines the error schema for Google's JSON HTTP APIs.
    message Error {
      // Deprecated. This message is only used by error format v1.
      message ErrorProto {}
      // This message has the same semantics as `google.rpc.Status`. It uses HTTP
      // status code instead of gRPC status code. It has extra fields `status` and
      // `errors` for backward compatibility with [Google API Client
      // Libraries](https://developers.google.com/api-client-library).
      message Status {
        // The HTTP status code that corresponds to `google.rpc.Status.code`.
        int32 code = 1;
        // This corresponds to `google.rpc.Status.message`.
        string message = 2;
        // Deprecated. This field is only used by error format v1.
        repeated ErrorProto errors = 3;
        // This is the enum version for `google.rpc.Status.code`.
        google.rpc.Code status = 4;
        // This corresponds to `google.rpc.Status.details`.
        repeated google.protobuf.Any details = 5;
      }
      // The actual error payload. The nested message structure is for backward
      // compatibility with [Google API Client
      // Libraries](https://developers.google.com/api-client-library). It also
      // makes the error more readable to developers.
      Status error = 1;
    }
    
iso-error - [email protected]

Published by unional about 1 year ago

Patch Changes

  • 42df780: Relax the type of HttpStatusText to Record<number, string>.
    This allows user to use it by passing in an number:

    
    // `Response['status']: number`
    const response: Response = await fetch(...)
    
    const status = HttpStatusText[response.status]
    
iso-error - [email protected]

Published by unional about 1 year ago

Patch Changes

iso-error - [email protected]

Published by unional about 1 year ago

Patch Changes

  • 2fd15b8: Add required fields for responses.
    This is not a breaking change as it is a out field changes.
iso-error - [email protected]

Published by unional about 1 year ago

Minor Changes

  • 430aa8f: Add HttpStatusText map
iso-error - [email protected]

Published by unional about 1 year ago

Patch Changes

iso-error - [email protected]

Published by unional about 1 year ago

Minor Changes

  • 7cccde8: Refactor OpenApi specs.

    paths, responses, schemas are now in separate files.

    The overall spec example still needs to be updated.
    e.g. updating each case to show which http status code is appropriate.

Patch Changes

  • 39fd27c: Improve toCauses() logic so that it does not need as any.
iso-error - [email protected]

Published by unional over 1 year ago

Patch Changes

  • 9d56e0f: Adjust or add back main export.

    Allow older systems which does not support exports field to use the module.

  • Updated dependencies [9d56e0f]