Exception: Bureaucrat::ValidationError

Inherits:
Exception
  • Object
show all
Defined in:
lib/bureaucrat.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, code = nil, params = nil) ⇒ ValidationError



7
8
9
10
11
12
13
14
15
# File 'lib/bureaucrat.rb', line 7

def initialize(message, code = nil, params = nil)
  if message.is_a? Array
    @messages = message
  else
    @code = code
    @params = params
    @messages = [message]
  end
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code



5
6
7
# File 'lib/bureaucrat.rb', line 5

def code
  @code
end

#messagesObject (readonly)

Returns the value of attribute messages



5
6
7
# File 'lib/bureaucrat.rb', line 5

def messages
  @messages
end

#paramsObject (readonly)

Returns the value of attribute params



5
6
7
# File 'lib/bureaucrat.rb', line 5

def params
  @params
end

Instance Method Details

#to_sObject



17
18
19
# File 'lib/bureaucrat.rb', line 17

def to_s
  "ValidationError(#{@messages.inspect})"
end