nats-hemera
Advanced tools
Comparing version 0.3.13 to 0.3.14
@@ -66,12 +66,2 @@ 'use strict'; | ||
var m = ctx._encoder.encode.call(ctx, ctx._message); | ||
// throw encoding issue | ||
if (m.error) { | ||
return next(m.error); | ||
} | ||
ctx._request = m.value; | ||
ctx.log.info(pattern, `ACT_OUTBOUND - ID:${String(ctx._message.request.id)}`); | ||
@@ -78,0 +68,0 @@ |
@@ -728,6 +728,9 @@ 'use strict'; | ||
if (err) { | ||
var m = self._encoder.encode.call(self, self._message); | ||
var _error3 = new _errors2.default.HemeraError(_constants2.default.EXTENSION_ERROR).causedBy(err); | ||
// throw encoding issue | ||
if (m.error) { | ||
var _error3 = new _errors2.default.HemeraError(_constants2.default.EXTENSION_ERROR).causedBy(m.error); | ||
self.log.error(_error3); | ||
@@ -742,2 +745,17 @@ | ||
if (err) { | ||
var _error4 = new _errors2.default.HemeraError(_constants2.default.EXTENSION_ERROR).causedBy(err); | ||
self.log.error(_error4); | ||
if (hasCallback) { | ||
return cb.call(self, _error4); | ||
} | ||
return; | ||
} | ||
ctx._request = m.value; | ||
// use simple publish mechanism instead to fire a request | ||
@@ -763,10 +781,10 @@ if (pattern.pubsub$ === true) { | ||
var _error4 = new _errors2.default.ParseError(_constants2.default.PAYLOAD_PARSING_ERROR, { | ||
var _error5 = new _errors2.default.ParseError(_constants2.default.PAYLOAD_PARSING_ERROR, { | ||
pattern: self._cleanPattern | ||
}).causedBy(self._response.error); | ||
self.log.error(_error4); | ||
self.log.error(_error5); | ||
if (hasCallback) { | ||
return cb.call(self, _error4); | ||
return cb.call(self, _error5); | ||
} | ||
@@ -779,8 +797,8 @@ } | ||
var _error5 = new _errors2.default.HemeraError(_constants2.default.EXTENSION_ERROR).causedBy(err); | ||
var _error6 = new _errors2.default.HemeraError(_constants2.default.EXTENSION_ERROR).causedBy(err); | ||
self.log.error(_error5); | ||
self.log.error(_error6); | ||
if (hasCallback) { | ||
return cb.call(self, _error5); | ||
return cb.call(self, _error6); | ||
} | ||
@@ -797,7 +815,7 @@ | ||
var responseErrorCause = responseError.cause; | ||
var _error6 = new _errors2.default.BusinessError(_constants2.default.BUSINESS_ERROR, { | ||
var _error7 = new _errors2.default.BusinessError(_constants2.default.BUSINESS_ERROR, { | ||
pattern: self._cleanPattern | ||
}).causedBy(responseErrorCause ? responseError.cause : responseError); | ||
self.log.error(_error6); | ||
self.log.error(_error7); | ||
@@ -812,7 +830,7 @@ return cb.call(self, responseError); | ||
var _error7 = new _errors2.default.FatalError(_constants2.default.FATAL_ERROR, { | ||
var _error8 = new _errors2.default.FatalError(_constants2.default.FATAL_ERROR, { | ||
pattern: self._cleanPattern | ||
}).causedBy(err); | ||
self.log.fatal(_error7); | ||
self.log.fatal(_error8); | ||
@@ -864,7 +882,7 @@ // let it crash | ||
var _error8 = new _errors2.default.FatalError(_constants2.default.FATAL_ERROR, { | ||
var _error9 = new _errors2.default.FatalError(_constants2.default.FATAL_ERROR, { | ||
pattern | ||
}).causedBy(err); | ||
_this4.log.fatal(_error8); | ||
_this4.log.fatal(_error9); | ||
@@ -871,0 +889,0 @@ // let it crash |
@@ -59,12 +59,2 @@ // @flow | ||
let m = ctx._encoder.encode.call(ctx, ctx._message) | ||
// throw encoding issue | ||
if (m.error) { | ||
return next(m.error) | ||
} | ||
ctx._request = m.value | ||
ctx.log.info(pattern, `ACT_OUTBOUND - ID:${String(ctx._message.request.id)}`) | ||
@@ -71,0 +61,0 @@ |
@@ -734,2 +734,18 @@ // @flow | ||
let m = self._encoder.encode.call(self, self._message) | ||
// throw encoding issue | ||
if (m.error) { | ||
let error = new Errors.HemeraError(Constants.EXTENSION_ERROR).causedBy(m.error) | ||
self.log.error(error) | ||
if (hasCallback) { | ||
return cb.call(self, error) | ||
} | ||
return | ||
} | ||
if (err) { | ||
@@ -748,2 +764,4 @@ | ||
ctx._request = m.value | ||
// use simple publish mechanism instead to fire a request | ||
@@ -750,0 +768,0 @@ if (pattern.pubsub$ === true) { |
{ | ||
"name": "nats-hemera", | ||
"author": "Dustin Deus (https://github.com/StarpTech)", | ||
"version": "0.3.13", | ||
"version": "0.3.14", | ||
"main": "build/index.js", | ||
@@ -39,3 +39,3 @@ "homepage": "https://hemerajs.github.io/hemera/", | ||
"build": "babel ./lib --out-dir ./build --copy-files --source-maps", | ||
"prepublish": "npm run lint && npm run build" | ||
"prepublish": "npm run build" | ||
}, | ||
@@ -42,0 +42,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
139418
2468