Catch network errors when testing integrations
Summary
With certain settings, testing an integration can result in a 500 error. The user sees a message like this:
Steps to reproduce
For example, using the Webex Teams integration and a URL of http://example.com:1234
results in a Net::OpenTimeout
error:
- https://sentry.gitlab.net/gitlab/gitlabcom/issues/2505499/
- https://sentry.gitlab.net/gitlab/staginggitlabcom/issues/2504924/
What is the current bug behavior?
An uncaught exception is raised.
What is the expected correct behavior?
The user should see an error message with more details.
Output of checks
This bug happens on GitLab.com
Possible fixes
One option would be to catch all *Gitlab::HTTP::HTTP_ERRORS
at https://gitlab.com/gitlab-org/gitlab/blob/52ee44608ab9213674422e86ae462fa22420c47b/app/controllers/projects/services_controller.rb#L76, rather than just Gitlab::HTTP::BlockedUrlError
.
The messages from these exceptions should be safe to pass on to the user.