Skip to content

Return meta from retry.fail()Β #3789

@denchen

Description

@denchen

Currently, if you use retry with fetchBaseQuery(), and you bail out early (eg, because of a 4xx status), then the result is missing meta data.

The code for fail is:

function fail(e: any): never {
  throw Object.assign(new HandledError({ error: e }), {
    throwImmediately: true,
  })
}

So retry.fail() is only returning / throwing the error, and not returning the meta, although HandledError is capable of handling meta:

export class HandledError {
  constructor(
    public readonly value: any,
    public readonly meta: any = undefined
  ) {}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions