MVFv3 API Documentation
    Preparing search index...

    Type Parameters

    • E

    Implements

    • ErrBase<E>
    Index

    Constructors

    • Type Parameters

      • E

      Parameters

      • error: E

      Returns Err<E>

    Properties

    _tag: "Err" = 'Err'

    Accessors

    • get "[toStringTag]"(): string

      Returns string

    • get error(): E

      The error, if available.

      Returns E

    • get value(): null

      The good value, if available.

      Returns null

    Methods

    • Returns IterableIterator<never>

    • Returns the passed value if this is Ok, otherwise returns this.

      Type Parameters

      • U

      Parameters

      Returns Result<U, E>

    • Maps a Result<T, E> to Result<U, E | F> by applying a function to a contained Ok value, producing a new result.

      Type Parameters

      • U
      • F = E

      Parameters

      Returns Err<E>

    • Maps a Result<T, E> to Promise<Result<U, E | F>> by applying a function to a contained Ok value, producing a new async result.

      Type Parameters

      • U
      • F = E

      Parameters

      • fn: (value: never) => Promise<Result<U, F>>

      Returns Promise<Err<E>>

    • Returns an option of the inner error of a result.

      Returns Option<E>

    • Unwraps a result, yielding the value.

      USE THIS SPARINGLY! It is generally better to use unwrapOr or map to handle situations you may be temped to .expect() in.

      This is good for using in tests.

      Parameters

      • message: string

      Returns never

      A new error with the provided message, if the result is an Err.

    • Unwraps a result, yielding the error.

      USE THIS SPARINGLY! It is generally better to use unwrapOr or map to handle situations you may be temped to .expect() in.

      This is good for using in tests.

      Parameters

      • message: string

      Returns E

      A new error with the provided message, if the result is an Ok.

    • Allows inspection of the interior result value, if it is Ok. May be useful in cases where you do not want to modify the result.

      Returns Err<E>

    • Allows inspection of the interior error value, if it is Err. May be useful in cases where you do not want to modify the error.

      Parameters

      • fn: (error: E) => void

      Returns Err<E>

    • Asserts that the current result is Err.

      Returns this is Err<E>

    • Asserts that the current result is Err and the error passes the given predicate.

      Parameters

      • fn: (error: E) => boolean

      Returns this is Err<E>

    • Asserts that the current result is Ok.

      Returns this is Ok<never>

    • Asserts that the current result is Ok and the value passes the given predicate.

      Parameters

      • fn: (value: never) => boolean

      Returns this is Ok<never>

    • Returns IterableIterator<never>

    • Maps a Result<T, E> to Result<U, E> by applying a function to a contained Ok value, leaving the Err value untouched.

      Type Parameters

      • U

      Parameters

      • fn: (value: never) => U

      Returns Err<E>

    • Maps a Result<T, E> to Promise<Result<U, E>> by applying a function to a contained Ok value, leaving the Err value untouched.

      Type Parameters

      • U

      Parameters

      • fn: (value: never) => Promise<U>

      Returns Promise<Err<E>>

    • Maps a Result<T, E> to Result<T, F> by applying a function to a contained Err value, leaving the Ok value untouched.

      Type Parameters

      • F

      Parameters

      • fn: (error: E) => F

      Returns Err<F>

    • Maps a Result<T, E> to U by applying a function to a contained Ok value. If the result is an Err, the fallback value will be returned.

      Type Parameters

      • U

      Parameters

      • fn: (value: never) => U
      • fallback: U

      Returns U

    • Maps a Result<T, E> to Promise by applying a function to a contained Ok value. If the result is an Err, the fallback value will be returned.

      Type Parameters

      • U

      Parameters

      • fn: (value: never) => Promise<U>
      • fallback: U

      Returns Promise<U>

    • Maps a Result<T, E> to U by applying a function to a contained Ok value. If the result is an Err, the fallback function will be called and its result will be returned.

      Type Parameters

      • U

      Parameters

      • fn: (value: never) => U
      • fallback: () => U

      Returns U

    • Maps a Result<T, E> to Promise by applying a function to a contained Ok value. If the result is an Err, the fallback function will be called and its result will be returned.

      Type Parameters

      • U

      Parameters

      • fn: (value: never) => Promise<U>
      • fallback: () => Promise<U>

      Returns Promise<U>

    • Returns an option of the inner value of a result.

      Returns Option<never>

    • Returns the passed value if this is Err, otherwise returns this.

      Type Parameters

      • U
      • F

      Parameters

      Returns Result<U, F>

    • Calls fn if the result is an Err, otherwise returns this.

      Type Parameters

      • U
      • F

      Parameters

      Returns Result<U, F>

    • Returns a string representation of the result for debugging purposes.

      Returns string

    • Returns the inner value of a result, if it is Ok. Otherwise, the contained error will be thrown.

      USE THIS SPARINGLY! It is generally better to use unwrapOr or map to handle situations you may be temped to .unwrap() in.

      Returns never

      The contained error, if the result is an Err.

    • Returns the inner value of a result, if it is Ok. Otherwise, the provided fallback value will be returned.

      Type Parameters

      • V

      Parameters

      • fallback: V

      Returns V

    • Returns the inner value of a result, if it is Ok. Otherwise, the provided fallback funtion will be called and its result will be returned.

      Type Parameters

      • V

      Parameters

      • fn: () => V

      Returns V