1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

18 commits

Author SHA1 Message Date
Peter McCracken
4fc2ea1181 handle loops in the cause chain in Rescuable#rescue_with_handler 2017-05-10 13:33:46 -04:00
Sean Griffin
f48bb1b4ad Call fallback exception handlers with the right exception
The issue presented in #26246 showed a deeper underlying problem. When
we fell back to the exception handler for an exceptions cause, we were
calling that handler with the outer raised exception. This breaks the
calling code's expectations, especially if the exception has methods on
it behond those from `StandardError`.
2016-11-17 14:50:41 -05:00
Ryuta Kamizono
762e3f05f3 Add Style/EmptyLines in .rubocop.yml and remove extra empty lines 2016-08-07 17:50:59 +09:00
Xavier Noria
5c315a8fa6 modernizes hash syntax in activesupport 2016-08-06 19:38:33 +02:00
Xavier Noria
a731125f12 applies new string literal convention in activesupport/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:10:53 +02:00
Jeremy Daer
e35b98e6f5
Action Mailer: Declarative exception handling with rescue_from.
Follows the same pattern as controllers and jobs. Exceptions raised in
delivery jobs (enqueued by `#deliver_later`) are also delegated to the
mailer's rescue_from handlers, so you can handle the DeserializationError
raised by delivery jobs:

```ruby
class MyMailer < ApplicationMailer
  rescue_from ActiveJob::DeserializationError do
    …
  end
```

ActiveSupport::Rescuable polish:
* Add the `rescue_with_handler` class method so exceptions may be
  handled at the class level without requiring an instance.
* Rationalize `exception.cause` handling. If no handler matches the
  exception, fall back to the handler that matches its cause.
* Handle exceptions raised elsewhere. Pass `object: …` to execute
  the `rescue_from` handler (e.g. a method call or a block to
  instance_exec) against a different object. Defaults to `self`.
2016-05-15 18:44:16 -07:00
Genadi Samokovarov
dd96e8e333 Add class level case operator support for error dispatching in Rescuable 2014-12-10 02:34:59 +02:00
Erik Michaels-Ober
d1374f99bf Pass symbol as an argument instead of a block 2014-11-29 11:53:24 +01:00
Vipul A M
d745d62616 Fix some typo in method names, variables 2013-05-26 16:27:05 +05:30
Akira Matsuda
740d363890 Test that rescue_from accepts a class name in String 2013-01-23 13:29:40 +09:00
Aaron Patterson
b8d8c50785 use AS::TestCase as the base class 2012-01-05 17:12:46 -08:00
Christian Höltje
bb5e295d94 Rescuable spelling error 2011-10-03 10:15:31 -04:00
Santiago Pastorino
b451de0d6d Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) 2010-08-14 04:12:33 -03:00
Neeraj Singh
78c8242d2f strengthening the test suite for rescue_from
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-26 16:48:50 +02:00
Neeraj Singh
a5bb1f511f strengthening the rescue_from test suites
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-26 16:48:45 +02:00
Yehuda Katz
ff7db40464 No need to emulate default Ruby behavior in initialize 2010-02-10 14:40:36 -08:00
Yehuda Katz
bea38d64ee Don't rely on @message in Error classes being available for use 2010-02-10 14:40:36 -08:00
Pratik Naik
259a7a844b Add tests for ActiveSupport::Rescuable. Use ActiveSupport::Rescuable in ActionController::Base. 2008-10-04 22:13:50 +01:00