Adds proper emitting of errors.