Sha256: 44fc22e221e9cf7acac7ae135f5741ad46a3cfdbbabc261539a5c8341ca64955
Contents?: true
Size: 669 Bytes
Versions: 3
Compression:
Stored size: 669 Bytes
Contents
require 'grape/exceptions/base' module Grape module Exceptions class Validation < Grape::Exceptions::Base attr_accessor :params attr_accessor :message_key def initialize(args = {}) fail 'Params are missing:' unless args.key? :params @params = args[:params] args[:message] = translate_message(args[:message]) if args.key? :message super 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 def to_s message end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
grape-0.16.2 | lib/grape/exceptions/validation.rb |
grape-0.16.1 | lib/grape/exceptions/validation.rb |
grape-0.15.0 | lib/grape/exceptions/validation.rb |