Sha256: 89a07c45f8f0fa5774c79319273135df7c6fb13e84c4f2dc4ff6cd6553e45371
Contents?: true
Size: 644 Bytes
Versions: 1
Compression:
Stored size: 644 Bytes
Contents
require 'grape/exceptions/base' module Grape module Exceptions class Validation < Grape::Exceptions::Base attr_accessor :params def initialize(args = {}) raise "Params are missing:" unless args.key? :params @params = args[:params] args[:message] = translate_message(args[:message_key]) if args.key? :message_key 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
grape-0.9.0 | lib/grape/exceptions/validation.rb |