Permalink
Browse files

card error handling cleanup

  • Loading branch information...
1 parent 9bc9f9b commit 1c06567417e3620700c2e3dd046cf7adf55fc4a0 @ethn ethn committed Dec 21, 2016
Showing with 4 additions and 3 deletions.
  1. +2 −0 card/lib/card/error.rb
  2. +2 −2 card/lib/card/format/error.rb
  3. +0 −1 wagn/rails/controllers/card_controller.rb
@@ -45,6 +45,8 @@ def initialize status, msg=""
class << self
def exception_view card, exception
+ Card::Error.current = exception
+
case exception
## arguably the view and status should be defined in the error class;
## some are redundantly defined in view
@@ -3,8 +3,8 @@ class Format
module Error
def rescue_view e, view
raise e if Rails.env =~ /^cucumber|test$/
- Card::Error.current = e
- card.notable_exception_raised
+ error_view = Card::Error.exception_view @card, e
+ # TODO: consider rendering dynamic error view here.
rendering_error e, view
end
@@ -127,7 +127,6 @@ def render_errors
rescue_from StandardError do |exception|
Rails.logger.info "exception = #{exception.class}: #{exception.message}"
@card ||= Card.new
- Card::Error.current = exception
show Card::Error.exception_view(@card, exception)
end
end

0 comments on commit 1c06567

Please sign in to comment.