(cb, path)
| 304 | } |
| 305 | |
| 306 | function 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 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…