Add tests for thrown errors