Added a test with on_error