nats-hemera
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -288,8 +288,8 @@ 'use strict' | ||
/** | ||
* | ||
* | ||
* @readonly | ||
* | ||
* @memberOf Hemera | ||
*/ | ||
* | ||
* | ||
* @readonly | ||
* | ||
* @memberOf Hemera | ||
*/ | ||
get config() { | ||
@@ -300,8 +300,8 @@ return this._config | ||
/** | ||
* | ||
* | ||
* @readonly | ||
* | ||
* @memberof Hemera | ||
*/ | ||
* | ||
* | ||
* @readonly | ||
* | ||
* @memberof Hemera | ||
*/ | ||
get errorDetails() { | ||
@@ -336,8 +336,8 @@ if (this._isServer) { | ||
/** | ||
* Create a custom super error object without to start hemera | ||
* | ||
* @readonly | ||
* | ||
* @memberOf Hemera | ||
*/ | ||
* Create a custom super error object without to start hemera | ||
* | ||
* @readonly | ||
* | ||
* @memberOf Hemera | ||
*/ | ||
static createError(name) { | ||
@@ -478,4 +478,5 @@ const ctor = SuperError.subclass(name) | ||
throw new Error( | ||
`The dependency '${dependency}' was not registered before plugin '${this | ||
.plugin$.name}'` | ||
`The dependency '${dependency}' was not registered before plugin '${ | ||
this.plugin$.name | ||
}'` | ||
) | ||
@@ -489,6 +490,7 @@ } | ||
* | ||
* @returns | ||
* @param {any} plugin | ||
* @param {any} opts | ||
* @memberof Hemera | ||
*/ | ||
_use(plugin, opts, shallowKeys) { | ||
_use(plugin, opts) { | ||
let pluginOpts = Hoek.clone(plugin[Symbol.for('options')] || {}) | ||
@@ -916,8 +918,15 @@ pluginOpts = Object.assign(pluginOpts, opts) | ||
} else { | ||
const promise = action(self._request.payload.pattern) | ||
let result = action(self._request.payload.pattern) | ||
const isPromise = result && typeof result.then === 'function' | ||
if (promise && typeof promise.then === 'function') { | ||
promise | ||
if (isPromise) { | ||
result | ||
.then(x => self._actionHandler(null, x)) | ||
.catch(e => self._actionHandler(e)) | ||
} else { | ||
if (result instanceof Error) { | ||
self._actionHandler(result) | ||
} else { | ||
self._actionHandler(null, result) | ||
} | ||
} | ||
@@ -924,0 +933,0 @@ } |
{ | ||
"name": "nats-hemera", | ||
"author": "Dustin Deus (https://github.com/StarpTech)", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"main": "lib/index.js", | ||
@@ -6,0 +6,0 @@ "homepage": "https://hemerajs.github.io/hemera/", |
2786
70510