Skip to main content
Version: Next

ResponseError.fromResponse()

Home > @backstage/errors > ResponseError > fromResponse

Constructs a ResponseError based on a failed response.

Assumes that the response has already been checked to be not ok. This function consumes the body of the response, and assumes that it hasn't been consumed before.

Signature:

static fromResponse(response: ConsumedResponse & {
text(): Promise<string>;
}): Promise<ResponseError>;

Parameters

Parameter

Type

Description

response

ConsumedResponse & { text(): Promise<string>; }

**Returns:**

Promise<ResponseError>