MCPcopy Index your code
hub / github.com/github-tools/github / callbackErrorOrThrow

Function callbackErrorOrThrow

lib/Requestable.js:306–325  ·  view source on GitHub ↗
(cb, path)

Source from the content-addressed store, hash-verified

304}
305
306function callbackErrorOrThrow(cb, path) {
307 return function handler(object) {
308 let error;
309 if (object.hasOwnProperty('config')) {
310 const {response: {status, statusText}, config: {method, url}} = object;
311 let message = (`${status} error making request ${method} ${url}: "${statusText}"`);
312 error = new ResponseError(message, path, object);
313 log(`${message} ${JSON.stringify(object.data)}`);
314 } else {
315 error = object;
316 }
317 if (cb) {
318 log('going to error callback');
319 cb(error);
320 } else {
321 log('throwing error');
322 throw error;
323 }
324 };
325}

Callers 2

_requestMethod · 0.85
_requestAllPagesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…