@imqueue/rpc
Version:
RPC-like client-service implementation over messaging queue
36 lines • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AFTER_HOOK_ERROR = exports.BEFORE_HOOK_ERROR = void 0;
exports.IMQError = IMQError;
exports.BEFORE_HOOK_ERROR = 'Before call hook error:';
exports.AFTER_HOOK_ERROR = 'After call hook error:';
// istanbul ignore next
/**
* Builds JSON representation of IMQ Error
*
* @param {string} code - error code
* @param {string} message - error message
* @param {string} stack - error stack
* @param {string} method - IMQ service method called, which produced an error
* @param {any} args - IMQ service method call args passed
* @param {any} [original] - Original error thrown (JSON'ified) if any
* @return {IMQRPCError}
*/
function IMQError(code, message, stack, method, args, original) {
return {
code,
message,
stack: stack || '',
method: method || '',
args: JSON.stringify(args, null, 2),
original: (() => {
try {
return JSON.stringify(original);
}
catch (err) {
return undefined;
}
})(),
};
}
//# sourceMappingURL=IMQRPCError.js.map