@octokit/graphql
Version:
GitHub GraphQL API client for browsers and Node
28 lines (27 loc) • 717 B
JavaScript
function _buildMessageForResponseErrors(data) {
return `Request failed due to following response errors:
` + data.errors.map((e) => ` - ${e.message}`).join("\n");
}
class GraphqlResponseError extends Error {
constructor(request, headers, response) {
super(_buildMessageForResponseErrors(response));
this.request = request;
this.headers = headers;
this.response = response;
this.errors = response.errors;
this.data = response.data;
/* v8 ignore if -- @preserve */
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
}
}
request;
headers;
response;
name = "GraphqlResponseError";
errors;
data;
}
export {
GraphqlResponseError
};