Moleculer: Catching errors between nodes

Created on 10 Apr 2021  路  3Comments  路  Source: moleculerjs/moleculer

Is it possible right now to catch error that was thrown in another node? For example:

We had Node0 that contains service abc with action called dosth; That action inside calls xyz.gandalf and wait for it completes and also listen for errors to catch:

try {
await broker.call("xyz.gandalf", params, options);
}
catch(err) {
console.error(err);
}

We had also Node1 that contains service xyz with action called gandalf - which always throws error like this: throw new Error("You shall not pass");

Does that kind of catching errors works with moleculer.js?
Does moleculer.js sends errors through transporter?

Question

All 3 comments

Yeah, the Error will be serialized and transferred to the caller service.

Thanks. BTW. Really awesome framework. A library that focuses mainly on micro-services was very much needed. It is very logical and well organized.

Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rozhddmi picture rozhddmi  路  4Comments

kesslerdev picture kesslerdev  路  4Comments

icebob picture icebob  路  3Comments

demetriusnunes picture demetriusnunes  路  5Comments

DarkBlaez picture DarkBlaez  路  4Comments