Class LoggerResult<T>

A "result" type that is used in conjuction with the LoggerError enum to describe and handle a possible error returned from the log functions.

Type Parameters

  • T

Hierarchy

  • LoggerResult

Constructors

Properties

Methods

Constructors

Properties

inner: null | T | LoggerError = null
message?: string

Methods

  • Returns whether or not the inner value of this result type is LoggerError.

    Returns boolean

  • Returns whether or not the inner value of this result type is T.

    Returns boolean

  • Returns the T value if the inner value is expected to be T, otherwise return null.

    Returns null | T

  • Returns an object containing the inner data and the optional message if it is expected to be a LoggerError, otherwise return null.

    Returns null | {
        error: LoggerError;
        message: undefined | string;
    }

  • Create a new LoggerResult<T> that is guaranteed to have an inner data of LoggerError with an optional accompanying message string.

    Type Parameters

    • T

    Parameters

    • error: LoggerError

      The enum describes the reason behind the error.

    • Optional message: string

      The optional message for additional context to the error.

    Returns LoggerResult<T>

  • Create a new LoggerResult<T> that is guaranteed to have an inner data of type T.

    Type Parameters

    • T

    Parameters

    • data: T

      The T data to insert into the inner value of this result type.

    Returns LoggerResult<T>

Generated using TypeDoc