aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-05-02 11:55:14 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-05-02 11:55:27 -0700
commit976e7e44ee68cb32f74a8de9b81e18800e42065b (patch)
treefcd95112b9af4db8a5327dc79a64f0c385b208b7 /actionpack
parentae8f4974d1acea4c46e21f6ba29d90dbb43b0979 (diff)
downloadrails-976e7e44ee68cb32f74a8de9b81e18800e42065b.tar.gz
rails-976e7e44ee68cb32f74a8de9b81e18800e42065b.tar.bz2
rails-976e7e44ee68cb32f74a8de9b81e18800e42065b.zip
* move exception message to exception constructor
* save original exception * keep original backtrace
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/middleware/session/abstract_store.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb b/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
index 45a00b5056..e82132b445 100644
--- a/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
+++ b/actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
@@ -7,6 +7,15 @@ require 'active_support/core_ext/object/blank'
module ActionDispatch
module Session
class SessionRestoreError < StandardError #:nodoc:
+ attr_reader :original_exception
+
+ def initialize(const_error)
+ @original_exception = const_error
+
+ super("Session contains objects whose class definition isn't available.\n" +
+ "Remember to require the classes for all objects kept in the session.\n" +
+ "(Original exception: #{const_error.message} [#{const_error.class}])\n")
+ end
end
module DestroyableSession
@@ -58,11 +67,8 @@ module ActionDispatch
begin
# Note that the regexp does not allow $1 to end with a ':'
$1.constantize
- rescue LoadError, NameError => const_error
- raise ActionDispatch::Session::SessionRestoreError,
- "Session contains objects whose class definition isn't available.\n" +
- "Remember to require the classes for all objects kept in the session.\n" +
- "(Original exception: #{const_error.message} [#{const_error.class}])\n"
+ rescue LoadError, NameError => e
+ raise ActionDispatch::Session::SessionRestoreError, e, e.backtrace
end
retry
else