fix: avoid (repeatedly) emitting 'prepared' event on error
fix: avoid (repeatedly) emitting 'prepared' event on error

'prepared' was emitted on error because the callback error argument was
not checked.

'prepared' was emitted again if an error occurred again before the emit
call returned
because the prepared flag was only updated after emitting the event.

tediousjs/tedious,tediousjs/tedious,pekim/tedious