frontend/.pnpm-store/v3/files/88/ace7a8b76206603367bcd1386fd958fd6e6ec0b8ef20485016c48e84db125a4346eb4c92d9b692671e776d9c44c6cf996ff5c9329142ad4128b6d0a5cf98e6

22 lines
843 B
Plaintext

function _buildMessageForResponseErrors(data) {
return (`Request failed due to following response errors:\n` +
data.errors.map((e) => ` - ${e.message}`).join("\n"));
}
export class GraphqlResponseError extends Error {
constructor(request, headers, response) {
super(_buildMessageForResponseErrors(response));
this.request = request;
this.headers = headers;
this.response = response;
this.name = "GraphqlResponseError";
// Expose the errors and response data in their shorthand properties.
this.errors = response.errors;
this.data = response.data;
// Maintains proper stack trace (only available on V8)
/* istanbul ignore next */
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
}
}