Sha256: 708d0e8f7202ca15797c8edf6dcc48830cf6afc572838f8e4fb4139f96daf1fc
Contents?: true
Size: 662 Bytes
Versions: 4
Compression:
Stored size: 662 Bytes
Contents
# frozen_string_literal: true require 'grape/exceptions/base' module Grape module Exceptions class Validation < Grape::Exceptions::Base attr_accessor :params, :message_key def initialize(params:, message: nil, **args) @params = params if message @message_key = message if message.is_a?(Symbol) args[:message] = translate_message(message) end super(**args) end # Remove all the unnecessary stuff from Grape::Exceptions::Base like status # and headers when converting a validation error to json or string def as_json(*_args) to_s end end end end
Version data entries
4 entries across 4 versions & 1 rubygems