UNPKG

amqplib

Version:

An AMQP 0-9-1 (e.g., RabbitMQ) library and client.

24 lines (18 loc) 675 B
const inherits = require('node:util').inherits; function trimStack(stack, num) { return stack && stack.split('\n').slice(num).join('\n'); } function IllegalOperationError(msg, stack) { const tmp = new Error(); this.message = msg; this.stack = `${this.toString()}\n${trimStack(tmp.stack, 2)}`; this.stackAtStateChange = stack; } inherits(IllegalOperationError, Error); IllegalOperationError.prototype.name = 'IllegalOperationError'; function stackCapture(reason) { const e = new Error(); return `Stack capture: ${reason}\n${trimStack(e.stack, 2)}`; } module.exports.IllegalOperationError = IllegalOperationError; module.exports.stackCapture = stackCapture;