citi-oauth
Advanced tools
Comparing version 1.6.3 to 1.6.4
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const ramda_1 = __importDefault(require("ramda")); | ||
class CitiAPIError extends Error { | ||
@@ -11,18 +15,21 @@ constructor(msg) { | ||
return async (url, data, options) => { | ||
if (!settings.logger) { | ||
settings.logger = console; | ||
} | ||
try { | ||
const { data: res } = await requestFunc(url.startsWith('http') ? url : `${settings.endpoint}${url}`, data, options); | ||
if (res.errcode) { | ||
const error = new CitiAPIError(res.errmsg); | ||
error.code = res.errcode; | ||
error.meta = { url, options }; | ||
throw error; | ||
} | ||
return res; | ||
return ramda_1.default.tap((res) => { | ||
if (res.errcode) { | ||
const error = new CitiAPIError(res.errmsg); | ||
error.code = res.errcode; | ||
error.meta = { url, options }; | ||
throw error; | ||
} | ||
})(res); | ||
} | ||
catch (err) { | ||
; | ||
(settings.logger || console).error('碰到了错误!', JSON.stringify(err.response.data)); | ||
settings.logger.error('碰到了错误!', err.response); | ||
err.request = {}; | ||
err.response = { data: err.response ? err.response.data : null }; | ||
(settings.logger || console).error(err); | ||
settings.logger.error(err); | ||
if (!(err instanceof CitiAPIError)) { | ||
@@ -35,2 +42,2 @@ err.name = 'CitiAPI' + err.name; | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy91dGlsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsTUFBTSxZQUFhLFNBQVEsS0FBSztJQUk5QixZQUFZLEdBQVc7UUFDckIsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFBO1FBRVYsSUFBSSxDQUFDLElBQUksR0FBRyxjQUFjLENBQUE7SUFDNUIsQ0FBQztDQUNG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xNQUFNLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFBO1lBRTFCLElBQUksQ0FBQyxDQUFDLEdBQUcsWUFBWSxZQUFZLENBQUMsRUFBRTtnQkFDbEMsR0FBRyxDQUFDLElBQUksR0FBRyxTQUFTLEdBQUcsR0FBRyxDQUFDLElBQUksQ0FBQTthQUNoQztZQUVELE1BQU0sR0FBRyxDQUFBO1NBQ1Y7SUFDSCxDQUFDLENBQUE7QUFDSCxDQUFDLENBQUEifQ== |
{ | ||
"name": "citi-oauth", | ||
"version": "1.6.3", | ||
"version": "1.6.4", | ||
"description": "citi oauth typescript version", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
257096
1419