@siglesiasg/node-red-hyperledger-fabric-gateway
Version:
Hyperledger Fabric 2.x nodes for node-red with latest fabric-gateway library
23 lines • 895 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleError = void 0;
const fabric_gateway_1 = require("@hyperledger/fabric-gateway");
function handleError(node, done, error) {
if (error instanceof fabric_gateway_1.GatewayError) {
const attached = [];
for (const att of error.details) {
attached.push(`${att.mspId}-${att.address}-${att.message}`);
}
node.status({ fill: 'red', shape: 'dot', text: `${error.message} : ${attached.join('|')}` });
const outputError = new Error();
outputError.message = error.message;
outputError.stack = JSON.stringify(error.details);
done(outputError);
}
else {
node.status({ fill: 'red', shape: 'dot', text: error });
done(error);
}
}
exports.handleError = handleError;
//# sourceMappingURL=fabric-error-handler.js.map