Options
All
  • Public
  • Public/Protected
  • All
Menu

An error type and error messages.

Index

Types

Scalar

Scalar: string | number | boolean | null

Type of MgError.hint

MgError

MgError: { code: string; detail?: string; hint?: Scalar; message?: string }

Error type

Type declaration

  • code: string

    An error code. This is used to distinguish an error type from others.

  • Optional detail?: string

    A detail description for developers.

  • Optional hint?: Scalar

    A hint data to build an error message.

  • Optional message?: string

    An error message for users.
    Usually this property is undefined, so someone should call normalizeError() to generate a message.

NormalizeError

NormalizeError: (error: MgError) => MgError

Type declaration

Entries

Const isError

  • isError(x: any): boolean
  • Returns true if a given object is an instance of MgError

    Parameters

    • x: any

    Returns boolean

Const normalizeError

  • Extends a MgError for viewing, and returns its extended instance.
    Actually, this function adds message value to the error.

    Parameters

    • catalog: Record<string, string>

    Returns NormalizeError

Generated using TypeDoc