Emit the error at the end in case it results in an uncaught exception