I'd like to test for connection errors to an external api. What is the best way to go about and do this?

in my controller i have

```
begin
 result = connect.to_api
rescue Error::TooManyRequests => e
 flash = e
end

```

I'd like to test that the error gets displayed to the user.