summaryrefslogtreecommitdiff
path: root/lib/oxidized
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2015-02-22 13:46:37 +0200
committerSaku Ytti <saku@ytti.fi>2015-02-22 13:46:37 +0200
commit628ab4e2f74837dc04f7466a60a8783d23d5167a (patch)
tree95a5eb8f2700b62e0b815b16b03af2c0ed514c84 /lib/oxidized
parentaea148d771dca0e10ca1a2f5505446fbc689dad2 (diff)
Give more helpful error message from git errors
closes #61
Diffstat (limited to 'lib/oxidized')
-rw-r--r--lib/oxidized/output/git.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/oxidized/output/git.rb b/lib/oxidized/output/git.rb
index 0c73638..d5eb8e7 100644
--- a/lib/oxidized/output/git.rb
+++ b/lib/oxidized/output/git.rb
@@ -1,5 +1,6 @@
module Oxidized
class Git < Output
+ class GitError < OxidizedError; end
begin
gem 'rugged', '~> 0.21.0'
require 'rugged'
@@ -71,8 +72,12 @@ class Git < Output
end
repo = Rugged::Repository.new repo
update_repo repo, file, data, @msg, @user, @email
- rescue Rugged::OSError, Rugged::RepositoryError
- Rugged::Repository.init_at repo, :bare
+ rescue Rugged::OSError, Rugged::RepositoryError => open_error
+ begin
+ Rugged::Repository.init_at repo, :bare
+ rescue => create_error
+ raise GitError, "first '#{open_error.message}' was raised while opening git repo, then '#{create_error.message}' was while trying to create git repo"
+ end
retry
end