Documentation
    Preparing search index...

    Type Alias ExceptionsAPI

    Actual Type: Struct
    Note: Stripped to generate better documentation.

    The API for Exceptions.

    The Serializable equivalent of a vanilla JavaScript Error.

    type ExceptionsAPI = {
        createException: (
            message?: string,
            options?: ExceptionOptions,
        ) => Exception;
        createTypeException: (
            message?: string,
            options?: ExceptionOptions,
        ) => TypeException;
        createAggregateException: (
            errors: List<Serializable[]>,
            message?: string,
            options?: ExceptionOptions,
        ) => AggregateException;
        createSerializableException: (
            message?: string,
            options?: ExceptionOptions,
        ) => SerializableException;
    }
    Index

    Properties

    createException: (message?: string, options?: ExceptionOptions) => Exception

    Actual Type: Method
    Note: Stripped to generate better documentation.

    Creates an Exception.

    Type Declaration

    const { exceptions } = createFutureMachine(futureDatabase);
    const exception: Exception = exceptions.createException('MyError', {
    cause: 'Original Exception message',
    });
    createTypeException: (
        message?: string,
        options?: ExceptionOptions,
    ) => TypeException

    Actual Type: Method
    Note: Stripped to generate better documentation.

    Creates a TypeException. An exception thrown for unexpected types.

    Type Declaration

    const { exceptions } = createFutureMachine(futureDatabase);
    const exception: TypeException = exceptions.createTypeException('MyError', {
    cause: 'Original Exception message',
    });
    createAggregateException: (
        errors: List<Serializable[]>,
        message?: string,
        options?: ExceptionOptions,
    ) => AggregateException

    Actual Type: Method
    Note: Stripped to generate better documentation.

    Creates an AggregateException. Thrown to aggregate multiple exceptions as one. E.g. when all of the FuturesAPI.any() Future reject.

    Type Declaration

    const { exceptions, containers } = createFutureMachine(futureDatabase);
    const error1 = exceptions.createException('First failure');
    const error2 = exceptions.createException('Second failure');
    const errorList = containers.list.create(error1, error2);
    const exception: AggregateException = exceptions.createAggregateException(
    errorList,
    'Multiple operations failed'
    );
    createSerializableException: (
        message?: string,
        options?: ExceptionOptions,
    ) => SerializableException

    Actual Type: Method
    Note: Stripped to generate better documentation.

    Creates a SerializableException. An exception thrown when a value cannot be serialized. E.g. when a Method throws a non-Serializable type.

    Type Declaration

    const { exceptions } = createFutureMachine(futureDatabase);
    const exception: SerializableException =
    exceptions.createSerializableException('MyError', {
    cause: 'Original Exception message',
    });