Closed skadefro closed 3 months ago
When using async functions next
is completely ignored and instead, you should use throw err
ahh, makes sense. thank you.
It is even documented here, i see https://github.com/zone-eu/zone-mta/tree/master/plugins#available-hooks
I'm not sure if this is a bug or just me not fully understanding everything, but it took me an embarrassingly long time to figure out why I could not 'reject' mails using an error object with next(errObject) or next(app.reject(...)). It turns out (at least for
app.addHook('message:store')
andapp.addHook('message:queue')
that if you make the function async, it completely ignores the next() call. My workaround was to simply wrap the function in a setTimeout, and then everything works perfectly again. Works:calling next(err) does not work
you could/should also just call an async function from within the non async function, but this looks more clean to me.