rhodonite
    Preparing search index...

    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

    Index

    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

    • 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')

    • Provides an alternative result since this result failed. Calls the provided function to get an alternative result.

      Type Parameters

      • U

        The type of the alternative success value

      Parameters

      • f: () => Result<U, ErrObj>

        Function that provides an alternative result

      Returns Result<U, ErrObj>

      The result of the alternative function

    • 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

      • catchFn: (err: RnError<ErrObj>) => T

        Function that provides a fallback value based on the error

      Returns T

      The compensated value from the catch function