Just to add another pattern that can give you more control:
instead of trowing the error and getting the long error generate by bubble, you can always return a value but you include 2 extra properties: errormessage
and returnederror
. It’s similar to what happens with the API connector when you check include errors. You never throw and handle failures in the workflow by checking returnederror
, and errormessage
is just a text for bubble so it will not add other logs to it.
example:
const [error, msg] = context.async(async (callback) => {
try {
const response = await axios.get("your url");
callback(null, [null, response.statusText || "ok"]);
} catch (error) {
callback(null, [error, null]);
}
});
const pluginResponse = {
msg,
errormessage: error?.message,
returnederror: !!error,
};
return pluginResponse;