Class Err<T, ErrObj>

Represents a failed result containing an error. This class indicates that an operation failed with specific error information.

Type Parameters

  • T

    The type of the success value (for type compatibility)

  • ErrObj

    The type of the error object

Hierarchy

Implements

Constructors

Properties

_rnException: RnException<ErrObj>

The RnException instance created from the error

val?: T | RnError<ErrObj>

The value to store (either success value or error)

Methods

  • Returns this Err result unchanged since the operation already failed. The chaining function is not called.

    Type Parameters

    • U

      The type of the new success value

    Parameters

    Returns Result<U, ErrObj>

    This Err result cast to the new type

  • Always returns false for Err results.

    Returns false

    Always false

    This method seems to be unused

  • Pattern matching implementation for Result types.

    Type Parameters

    • R

      The type of the return value from the Ok function

    • ErrObj2

      The type of the new error object

    Parameters

    Returns Result<R, ErrObj2>

    A new Result containing the result of the pattern matching

    If the result is neither Ok nor Err

  • Gets the name of this result class.

    Returns string

    The constructor name ('Ok' or 'Err')

  • Converts this error to a string representation.

    Returns string

    The stack trace from the contained exception

  • Throws an exception since this result contains an error.

    Returns never

    Never returns (always throws)

    Always throws the contained exception

  • Calls the compensation function to provide a fallback value.

    Parameters

    Returns T

    The compensated value from the catch function