module Terrific::Mappable::ClassMethods
Public Instance Methods
map_error(*klasses, options)
click to toggle source
# File lib/terrific/mappable.rb, line 14 def map_error(*klasses, options) rescue_from *klasses do |exception| status = options.fetch(:to) error = Error.new(exception, options.slice(:type, :message)) render status: status, json: { error: error } end end