Skip to content

Commit

Permalink
Added Hide::GitError to easily throw and catch errors from Git commands
Browse files Browse the repository at this point in the history
  • Loading branch information
karmi committed Mar 2, 2011
1 parent 26c86de commit e10ff87
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/hide/git.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
module Hide
class GitError < Exception; end

class Git

def initialize(path, sha1, sha2)
Expand All @@ -13,7 +15,7 @@ def changed_files

def in_repo command
output = %x[git --git-dir=#{@path}/.git #{command} 2>&1]
raise Exception, output unless $?.success?
raise GitError, output unless $?.success?
output
end

Expand Down

0 comments on commit e10ff87

Please sign in to comment.