Skip to content
Browse files

Merge pull request #182 from jetthoughts/simplify-method

Removed useless `begin` and `end` for exceptions inside the method
  • Loading branch information...
2 parents ea90600 + 5cbfa1a commit e324b59de5677364e31188f20466db9787a4e92d @jimweirich committed
Showing with 11 additions and 13 deletions.
  1. +11 −13 lib/rake/application.rb
View
24 lib/rake/application.rb
@@ -156,19 +156,17 @@ def parse_task_string(string)
# Provide standard exception handling for the given block.
def standard_exception_handling
- begin
- yield
- rescue SystemExit => ex
- # Exit silently with current status
- raise
- rescue OptionParser::InvalidOption => ex
- $stderr.puts ex.message
- exit(false)
- rescue Exception => ex
- # Exit with error message
- display_error_message(ex)
- exit_because_of_exception(ex)
- end
+ yield
+ rescue SystemExit => ex
+ # Exit silently with current status
+ raise
+ rescue OptionParser::InvalidOption => ex
+ $stderr.puts ex.message
+ exit(false)
+ rescue Exception => ex
+ # Exit with error message
+ display_error_message(ex)
+ exit_because_of_exception(ex)
end
# Exit the program because of an unhandle exception.

0 comments on commit e324b59

Please sign in to comment.
Something went wrong with that request. Please try again.