Skip to content

Commit

Permalink
card error handling cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ethn committed Dec 21, 2016
1 parent 9bc9f9b commit 1c06567
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions card/lib/card/error.rb
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions card/lib/card/format/error.rb
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion wagn/rails/controllers/card_controller.rb
Expand Up @@ -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.