Skip to content

Commit

Permalink
Monkey Patch Mnemosyne until Rails 7.1 support landed
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSerth committed Nov 24, 2023
1 parent e911f76 commit 1fb5e45
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions config/initializers/monkey_patches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,22 @@ def previous_or_next_page(page, text, classname, aria_label = nil)
end
end
end

# Required until Rails 7.1 is officially supported.
# See https://github.com/mnemosyne-mon/mnemosyne-ruby/pull/70
module Mnemosyne
class Trace
def attach_error(error)
case error
when ActionDispatch::ExceptionWrapper
@errors << Error.new(error.exception)
when Exception
@errors << Error.new(error)
when String
@errors << Error.new(RuntimeError.new(error))
else
raise ArgumentError.new "Invalid error type: #{error.inspect}"
end
end
end
end

0 comments on commit 1fb5e45

Please sign in to comment.