diff options
author | Stan Hu <stanhu@gmail.com> | 2019-01-12 15:18:22 -0800 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-01-12 22:14:08 -0800 |
commit | 660dcd5b7c038f86002ddecf3562e1b7018e143c (patch) | |
tree | dad44705328349dc4e0ed66253e65e6cee255776 /app/controllers/import | |
parent | 1161c99e5c5a6e717127b83665de00068d810e0e (diff) | |
download | gitlab-ce-660dcd5b7c038f86002ddecf3562e1b7018e143c.tar.gz |
Fix Bitbucket Server importer error handling
The importer would display a 500 error page if you attempted to import
using a non-existent DNS entry. This commit rescues known network issues
and consolidates them into
BitbucketServer::Connection::ConnectionError`. The previous error
handling in the paginator doesn't work because it returns a lazy
collection.
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/56154
Diffstat (limited to 'app/controllers/import')
-rw-r--r-- | app/controllers/import/bitbucket_server_controller.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/controllers/import/bitbucket_server_controller.rb b/app/controllers/import/bitbucket_server_controller.rb index 575c40d5f6f..87338488eba 100644 --- a/app/controllers/import/bitbucket_server_controller.rb +++ b/app/controllers/import/bitbucket_server_controller.rb @@ -40,7 +40,7 @@ class Import::BitbucketServerController < Import::BaseController else render json: { errors: 'This namespace has already been taken! Please choose another one.' }, status: :unprocessable_entity end - rescue BitbucketServer::Client::ServerError => e + rescue BitbucketServer::Connection::ConnectionError => e render json: { errors: "Unable to connect to server: #{e}" }, status: :unprocessable_entity end @@ -62,7 +62,7 @@ class Import::BitbucketServerController < Import::BaseController already_added_projects_names = @already_added_projects.pluck(:import_source) @repos.reject! { |repo| already_added_projects_names.include?(repo.browse_url) } - rescue BitbucketServer::Connection::ConnectionError, BitbucketServer::Client::ServerError => e + rescue BitbucketServer::Connection::ConnectionError => e flash[:alert] = "Unable to connect to server: #{e}" clear_session_data redirect_to new_import_bitbucket_server_path |