Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

re-throw by default, only re-raise if we already received an exceptio…

…n for bc
  • Loading branch information...
commit 460ff4cf95c8ea8951e2ac813bea89f57bf5ea1c 1 parent 9d85541
@svenfuchs authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/i18n/exceptions.rb
View
8 lib/i18n/exceptions.rb
@@ -1,15 +1,17 @@
module I18n
# Handles exceptions raised in the backend. All exceptions except for
- # MissingTranslationData exceptions are re-raised. When a MissingTranslationData
+ # MissingTranslationData exceptions are re-thrown. When a MissingTranslationData
# was caught the handler returns an error message string containing the key/scope.
- # Note that the exception handler is not called when the option :raise was given.
+ # Note that the exception handler is not called when the option :throw was given.
class ExceptionHandler
include Module.new {
def call(exception, locale, key, options)
if exception.is_a?(MissingTranslation)
options[:rescue_format] == :html ? exception.html_message : exception.message
- else
+ elsif exception.is_a?(Exception)
raise exception
+ else
+ throw :exception, exception
end
end
}
Please sign in to comment.
Something went wrong with that request. Please try again.