Best practice for use of Done and Error

Just to keep in mind that’s the new way that is not backwards compatible. Pre 1.0 or 1.2 compatibility would mean to use something like:

(done) ? done(err) : node.error(err);

As those older nodered versions don’t have the done function and in the new functions you should only call node.error() if for some reason you already called done() and an error happens afterwards for example in the on close function or doing async work.
At least that’s how I understand it.

Edit:
I also previously had the discussion when to call done in some edge cases here:

1 Like