@backblaze-labs/b2-sdk - v0.1.0
    Preparing search index...

    Interface FaultSpec

    Specification for a synthetic failure to return from the simulator's transport. See B2Simulator.injectFailure.

    interface FaultSpec {
        code?: string;
        count?: number;
        message?: string;
        on: string;
        retryAfter?: number;
        skip?: number;
        status?: number;
    }
    Index

    Properties

    code?: string

    B2 error code to return in the JSON body. Defaults to 'service_unavailable'.

    count?: number

    Number of matched requests to fail before the fault retires. Defaults to Number.POSITIVE_INFINITY (every matched request fails until cleared). Set to e.g. 3 to fail the next 3 matched requests then stop.

    message?: string

    Human-readable message. Defaults to 'simulated failure'.

    on: string

    URL substring matched against request.url. The fault triggers on every request whose URL contains this substring. Typically a B2 endpoint name like 'b2_upload_part', 'b2_authorize_account', 'b2_download_file_by_id', or '/file/' for download-by-name.

    retryAfter?: number

    If set, the synthetic response includes a Retry-After: <n> header (in seconds). Used to exercise the retry transport's Retry-After-respecting backoff path.

    skip?: number

    Number of matched requests to let through before failures start. Defaults to 0 (fail from the first matched request). Set to e.g. 2 to let the first 2 succeed and start failing on the 3rd.

    status?: number

    HTTP status to return. Defaults to 503.