Fix @test_throws deprecation warning