diff options
author | randx <dmitriy.zaporozhets@gmail.com> | 2012-08-29 01:44:26 +0400 |
---|---|---|
committer | randx <dmitriy.zaporozhets@gmail.com> | 2012-08-29 01:44:26 +0400 |
commit | b03ee4666bc5dfa3c509768918cbc8a477d24efb (patch) | |
tree | 8df629e9b0a1fd42a04861cb7c2f3906fa53cbf5 /lib | |
parent | c48c0f95b279e3fdaf0764d48711304beaa8ace8 (diff) |
Handle invalid ssh exception
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/backend/gitolite.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/gitlab/backend/gitolite.rb b/lib/gitlab/backend/gitolite.rb index 18b30500913..b69f4663c35 100644 --- a/lib/gitlab/backend/gitolite.rb +++ b/lib/gitlab/backend/gitolite.rb @@ -6,6 +6,7 @@ require 'fileutils' module Gitlab class Gitolite class AccessDenied < StandardError; end + class InvalidKey < StandardError; end def set_key key_id, key_content, projects configure do |c| @@ -190,8 +191,12 @@ module Gitlab end end rescue Exception => ex - Gitlab::Logger.error(ex.message) - raise Gitolite::AccessDenied.new("gitolite timeout") + if ex.message =~ /is not a valid SSH key string/ + raise Gitolite::InvalidKey.new("ssh key is not valid") + else + Gitlab::Logger.error(ex.message) + raise Gitolite::AccessDenied.new("gitolite timeout") + end end end end |