Comparing version 0.1.6 to 0.1.7
@@ -109,3 +109,4 @@ 'use strict'; | ||
var _ref3 = _asyncToGenerator(regeneratorRuntime.mark(function _callee2(ctx) { | ||
var res, throwError, type; | ||
var res, throwError, type, _type, _type2; | ||
return regeneratorRuntime.wrap(function _callee2$(_context2) { | ||
@@ -138,3 +139,3 @@ while (1) { | ||
return throwError(_extends({}, ctx, { | ||
err: { | ||
err: _extends({ | ||
type: type, | ||
@@ -144,9 +145,44 @@ status: res.status, | ||
message: type + ': ' + res.status + ' ' + res.statusText | ||
}, res.json || {}) | ||
})); | ||
case 8: | ||
if (!res.textErr) { | ||
_context2.next = 12; | ||
break; | ||
} | ||
_type = 'TEXT_PARSE_ERROR'; | ||
_context2.next = 12; | ||
return ctx.throwError(_extends({}, ctx, { | ||
res: res, | ||
err: { | ||
type: _type, | ||
message: 'Ошибка передачи данных', | ||
err: res.textErr | ||
} | ||
})); | ||
case 8: | ||
case 12: | ||
if (!res.jsonErr) { | ||
_context2.next = 16; | ||
break; | ||
} | ||
_type2 = 'JSON_PARSE_ERROR'; | ||
_context2.next = 16; | ||
return ctx.throwError(_extends({}, ctx, { | ||
res: res, | ||
err: { | ||
type: _type2, | ||
message: 'Ошибка сервера', | ||
// message: type, | ||
err: res.jsonErr | ||
} | ||
})); | ||
case 16: | ||
return _context2.abrupt('return', res.json); | ||
case 9: | ||
case 17: | ||
case 'end': | ||
@@ -250,4 +286,3 @@ return _context2.stop(); | ||
var _ref4 = _asyncToGenerator(regeneratorRuntime.mark(function _callee3(ctx, result) { | ||
var res, type, _type; | ||
var res; | ||
return regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
@@ -268,3 +303,3 @@ while (1) { | ||
res.text = _context3.sent; | ||
_context3.next = 12; | ||
_context3.next = 10; | ||
break; | ||
@@ -275,39 +310,14 @@ | ||
_context3.t0 = _context3['catch'](1); | ||
type = 'TEXT_PARSE_ERROR'; | ||
_context3.next = 12; | ||
return ctx.throwError(_extends({}, ctx, { | ||
res: res, | ||
err: { | ||
type: type, | ||
message: 'Ошибка передачи данных', | ||
err: _context3.t0 | ||
} | ||
})); | ||
case 12: | ||
_context3.prev = 12; | ||
res.textErr = _context3.t0; | ||
res.json = JSON.parse(res.text); | ||
_context3.next = 21; | ||
break; | ||
case 16: | ||
_context3.prev = 16; | ||
_context3.t1 = _context3['catch'](12); | ||
_type = 'JSON_PARSE_ERROR'; | ||
_context3.next = 21; | ||
return ctx.throwError(_extends({}, ctx, { | ||
res: res, | ||
err: { | ||
type: _type, | ||
message: 'Ошибка сервера', | ||
// message: type, | ||
err: _context3.t1 | ||
} | ||
})); | ||
case 21: | ||
case 10: | ||
try { | ||
res.json = JSON.parse(res.text); | ||
} catch (err) { | ||
res.jsonErr = err; | ||
} | ||
return _context3.abrupt('return', res); | ||
case 22: | ||
case 12: | ||
case 'end': | ||
@@ -317,3 +327,3 @@ return _context3.stop(); | ||
} | ||
}, _callee3, this, [[1, 7], [12, 16]]); | ||
}, _callee3, this, [[1, 7]]); | ||
})); | ||
@@ -447,2 +457,2 @@ | ||
exports.default = ApiClient; | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9hcGlxdWVyeS5qcyJdLCJuYW1lcyI6WyJGRVRDSF9QQVJBTVMiLCJBcGlDbGllbnQiLCJwYXJhbXMiLCJ0aHJvd0Vycm9yIiwiZXJyIiwicmVzIiwicmVxIiwic2hvd0Vycm9yIiwibG9nIiwic3RyIiwiSlNPTiIsInN0cmluZ2lmeSIsImpzb24iLCJlcnJvciIsIm1lc3NhZ2UiLCJlcnIyIiwiRXJyb3IiLCJpbyIsInJvb3QiLCJiYXNlIiwidXJsIiwid3NDb25maWciLCJ3cyIsImF1dGhUb2tlbiIsImN0eCIsInR5cGUiLCJzdGF0dXMiLCJzdGF0dXNUZXh0IiwicGF0aCIsIm9wdGlvbnMiLCJzdWJzdHIiLCJwb3J0IiwibGVuZ3RoIiwic2VhcmNo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Li50aGlzLnF1ZXJ5LFxuICAgICAgICAgIC4uLnBhcmFtcyxcbiAgICAgICAgfSk7XG4gICAgICB9LFxuICAgIH07XG4gIH1cblxuICB0aHJvd0Vycm9yID0gYXN5bmMgKHsgZXJyLCByZXMsIHJlcSB9KSA9PiB7XG4gICAgaWYgKHRoaXMuc2hvd0Vycm9yICYmIHRoaXMubG9nKSB7XG4gICAgICBjb25zdCBzdHIgPSBgXFxcbj09PT09PT09PT09PT09XG4gIGZldGNoIGVycm9yOlxuJHtpc1BsYWluT2JqZWN0KGVycikgPyBKU09OLnN0cmluZ2lmeShlcnIsIG51bGwsIDIpIDogZXJyfVxuICByZXE6XG4ke0pTT04uc3RyaW5naWZ5KHJlcSwgbnVsbCwgMil9XG4gIGpzb246XG4ke0pTT04uc3RyaW5naWZ5KHJlcy5qc29uLCBudWxsLCAyKX1cbj09PT09PT09PT09PT09XFxcbmA7XG4gICAgICB0aGlzLmxvZy5lcnJvcihzdHIpO1xuICAgIH1cbiAgICBjb25zdCBtZXNzYWdlID0gZXJyICYmIGVyci5tZXNzYWdlIHx8IGVycjtcbiAgICBjb25zdCBlcnIyID0gbmV3IEVycm9yKGlzUGxhaW5PYmplY3QobWVzc2FnZSkgPyBKU09OLnN0cmluZ2lmeShtZXNzYWdlKSA6IG1lc3NhZ2UpO1xuICAgIGVycjIucmVzID0gcmVzO1xuICAgIGVycjIucmVxID0gcmVxO1xuICAgIHRocm93IGVycjI7XG4gIH1cblxuICBhc3luYyBhZnRlckZldGNoKGN0eCkge1xuICAgIGNvbnN0IHsgcmVzLCB0aHJvd0Vycm9yIH0gPSBjdHg7XG4gICAgaWYgKHJlcy5qc29uICYmIHJlcy5qc29uLmVycikge1xuICAgICAgYXdhaXQgdGhyb3dFcnJvcih7XG4gICAgICAgIC4uLmN0eCxcbiAgICAgICAgZXJyOiB7XG4gICAgICAgICAgdHlwZTogJ0NVU1RPTV9FUlJPUicsXG4gICAgICAgICAgLi4ucmVzLmpzb24uZXJyLFxu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dGF0dXM6IHJlcy5zdGF0dXMsXG4gICAgICAgICAgc3RhdHVzVGV4dDogcmVzLnN0YXR1c1RleHQsXG4gICAgICAgICAgbWVzc2FnZTogYCR7dHlwZX06ICR7cmVzLnN0YXR1c30gJHtyZXMuc3RhdHVzVGV4dH1gLFxuICAgICAgICAgIC4uLihyZXMuanNvbiB8fCB7fSksXG4gICAgICAgIH0sXG4gICAgICB9KTtcbiAgICB9XG4gICAgaWYgKHJlcy50ZXh0RXJyKSB7XG4gICAgICBjb25zdCB0eXBlID0gJ1RFWFRfUEFSU0VfRVJST1InO1xuICAgICAgYXdhaXQgY3R4LnRocm93RXJyb3Ioe1xuICAgICAgICAuLi5jdHgsXG4gICAgICAgIHJlcyxcbiAgICAgICAgZXJyOiB7XG4gICAgICAgICAgdHlwZSxcbiAgICAgICAgICBtZXNzYWdlOiAn0J7RiNC40LHQutCwINC/0LXRgNC10LTQsNGH0Lgg0LTQsNC90L3Ri9GFJyxcbiAgICAgICAgICBlcnI6IHJlcy50ZXh0RXJyLFxuICAgICAgICB9LFxuICAgICAgfSk7XG4gICAgfVxuICAgIGlmIChyZXMuanNvbkVycikge1xuICAgICAgY29uc3QgdHlwZSA9ICdKU09OX1BBUlNFX0VSUk9SJztcbiAgICAgIGF3YWl0IGN0eC50aHJvd0Vycm9yKHtcbiAgICAgICAgLi4uY3R4LFxuICAgICAgICByZXMsXG4gICAgICAgIGVycjoge1xuICAgICAgICAgIHR5cGUsXG4gICAgICAgICAgbWVzc2FnZTogJ9Ce0YjQuNCx0LrQsCDRgdC10YDQstC10YDQsCcsXG4gICAgICAgICAgLy8gbWVzc2FnZTogdHlwZSxcbiAgICAgICAgICBlcnI6IHJlcy5qc29uRXJyLFxuICAgICAgICB9LFxuICAgICAgfSk7XG4gICAgfVxuICAgIHJldHVybiByZXMuanNvbjtcbiAgfVxuXG4gIGNyZWF0ZVVybChwYXRoLCBvcHRpb25zID0ge30pIHtcbiAgICBpZiAocGF0aC5zdWJzdHIoMCwg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Il19 |
{ | ||
"name": "apiquery", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "http + websockets api client for Web, Node.js and React Native", | ||
@@ -5,0 +5,0 @@ "repository": { |
149917
481