Fix error handler in test