An error returned by the y-sweet SDK.

Hierarchy

  • Error
    • YSweetError

Constructors

Properties

An object representing metadata associated with the error.

message: string
name: string
stack?: string
prepareStackTrace?: ((err, stackTraces) => any)

Optional override for formatting stack traces

Type declaration

    • (err, stackTraces): any
    • Parameters

      • err: Error
      • stackTraces: CallSite[]

      Returns any

stackTraceLimit: number

Methods

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • Optional constructorOpt: Function

    Returns void

  • In development, next.js passes error objects to the client but strips out everything but the message field. This method allows us to reconstruct the original error object.

    Parameters

    • messageString: string

      The error message string to reconstruct a payload from.

    Returns YSweetError

    A YSweetError object.

  • Convert the message to an error string that can be displayed to the user.

    The error string can also be used with YSweetError.fromMessage to reconstruct the payload object, which is useful in the context of Next.js, which will only pass an error string from the server to the client.

    Parameters

    Returns string

    A string representation of the error.