mappersmith
Advanced tools
Comparing version 2.20.0 to 2.21.0
@@ -7,2 +7,4 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var _manifest = require('./manifest'); | ||
@@ -70,2 +72,3 @@ | ||
var gatewayConfigs = this.manifest.gatewayConfigs; | ||
var requestPhaseExecutionFailed = false; | ||
@@ -75,3 +78,22 @@ var chainRequestPhase = function chainRequestPhase(requestPromise, middleware) { | ||
return middleware.request(request); | ||
}).catch(function (e) { | ||
if (requestPhaseExecutionFailed) { | ||
throw e; | ||
} | ||
requestPhaseExecutionFailed = true; | ||
var error = new Error('[Mappersmith] middleware "' + middleware.__name + '" failed in the request phase: ' + e.message); | ||
error.stack = e.stack; | ||
throw error; | ||
}).then(function (request) { | ||
if (request instanceof _request2.default) { | ||
return request; | ||
} | ||
requestPhaseExecutionFailed = true; | ||
var typeValue = typeof request === 'undefined' ? 'undefined' : _typeof(request); | ||
var prettyType = typeValue === 'object' || typeValue === 'function' ? request.name || typeValue : typeValue; | ||
throw new Error('[Mappersmith] middleware "' + middleware.__name + '" should return "Request" but returned "' + prettyType + '"'); | ||
}).then(function (request) { | ||
return _this3.Promise.resolve(request); | ||
@@ -78,0 +100,0 @@ }); |
@@ -97,2 +97,3 @@ 'use strict'; | ||
return (0, _utils.assign)({ | ||
__name: middlewareFactory.name || middlewareFactory.toString(), | ||
request: function request(_request) { | ||
@@ -99,0 +100,0 @@ return _request; |
@@ -18,3 +18,3 @@ 'use strict'; | ||
/* global VERSION */ | ||
var version = exports.version = '2.20.0'; | ||
var version = exports.version = '2.21.0'; | ||
@@ -21,0 +21,0 @@ var configs = exports.configs = { |
{ | ||
"name": "mappersmith", | ||
"version": "2.20.0", | ||
"version": "2.21.0", | ||
"description": "It is a lightweight rest client for node.js and the browser", | ||
@@ -5,0 +5,0 @@ "author": "Tulio Ornelas <ornelas.tulio@gmail.com>", |
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
109173
2118