Skip to content

Commit

Permalink
Having to say 'raise' to bring up an error message seems
Browse files Browse the repository at this point in the history
confrontational.

Alias 'sorry' to 'raise' to make this just a little
more polite.
  • Loading branch information
philcrissman committed Jul 28, 2015
1 parent 94078da commit 30e0533
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/canada.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,7 @@ module ::Kernel
def aboot(obj)
obj.inspect
end

alias :sorry :raise
end
end
6 changes: 6 additions & 0 deletions test/canada_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,10 @@ def test_exceptions_to_s
assert_match /(#{prefix}), (#{connector}) #{msg}/, Exception.new(msg).to_s
assert_match /(#{prefix}), (#{connector}) #{msg}/, Exception.new(msg).message
end

def test_sorry_raises
assert_raises Exception do
sorry Exception.new("Take off, eh")
end
end
end

0 comments on commit 30e0533

Please sign in to comment.