@cfxlabsinc/b2b-services
    Preparing search index...

    Type Alias ServiceError<Code, Details>

    ServiceError: { code: Code; message?: string; retryable: boolean } & Details

    Business/functional errors caused and returned in services

    Use in conjunction with Result. Instantiate with err function.

    Type Parameters

    • Code extends string

      The error code

    • Details extends object = object

      Optional additional fields that provide more information about the error

    Type Declaration

    • code: Code

      The code uniquely identifies the error and used in consumer error handling logic.

      Format: UPPER_SNAKE_CASE

    • Optionalmessage?: string

      Human-readable error for logging.

      Only necessary if error code is not descriptive enough. Or the same error code can be caused by various reasons (in rare cases that the consumer's action is the same for a group of errors).

    • retryable: boolean

      An error is retryable if trying the same request at a later time may overcome the error