Sha256: 34289ae6cde0f5e7521d13066a9dc792826e757e115b5f4f750ec0f67b043d0f
Contents?: true
Size: 646 Bytes
Versions: 2
Compression:
Stored size: 646 Bytes
Contents
require 'grape/exceptions/base' module Grape module Exceptions class Validation < Grape::Exceptions::Base attr_accessor :param def initialize(args = {}) raise "Param is missing:" unless args.has_key? :param @param = args[:param] args[:message] = translate_message(args[:message_key]) if args.has_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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
grape-0.7.0 | lib/grape/exceptions/validation.rb |
grape-0.6.1 | lib/grape/exceptions/validation.rb |