module Mountapi module Error # When a response does not match it's schema class InvalidResponse < StandardError def initialize(errors) @errors = errors super(errors) end def to_json_api @errors.map do |error| { id: error[:schema], title: error[:message], status: 500, source: { pointer: error[:fragment], parameter: error[:failed_attribute] } } end end end end end