Poq.SDK.Node

Home > @poq/sdk > PoqResponse > fromFailed

PoqResponse.fromFailed() method

Methods creates response object in case error 4xx occured during request.

Signature:

static fromFailed<T, PT = unknown>(response: AbstractResponse | PoqResponse<PT>, overrides?: {
        message?: string;
        errorMessage?: string;
    }): PoqResponse<T>;

Parameters

Parameter Type Description
response AbstractResponse | PoqResponse<PT> Original response from http client or wrapper.
overrides { message?: string; errorMessage?: string; } (Optional)

Returns:

PoqResponse<T>

The response with defined error messages that are taken from response body.

Example

console.log(PoqResponse.fromFailed(httpResponse));