Class: Glia::Errors::InvalidFormatError

Inherits:
Error
  • Object
show all
Defined in:
lib/glia/errors/client_errors.rb

Defined Under Namespace

Classes: Formats

Instance Attribute Summary

Attributes inherited from Error

#error_details, #message, #ref, #type

Instance Method Summary collapse

Methods inherited from Error

#to_h

Constructor Details

#initialize(field:, format: nil, message: nil) ⇒ InvalidFormatError

Returns a new instance of InvalidFormatError.



63
64
65
66
67
68
69
70
71
# File 'lib/glia/errors/client_errors.rb', line 63

def initialize(field:, format: nil, message: nil)
  default_message =
    format ? "has invalid format, required format is #{humanize_format(format)}" : 'has invalid format'
  super(
    type: INVALID_FORMAT_ERROR,
    ref: create_ref(INVALID_FORMAT_ERROR),
    message: message || "#{Naming.humanize(field)} #{default_message}"
  )
end