Exception: Bureaucrat::ValidationError

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

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (ValidationError) initialize(message, code = nil, params = nil)

Returns a new instance of 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

- (Object) code (readonly)

Returns the value of attribute code



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

def code
  @code
end

- (Object) messages (readonly)

Returns the value of attribute messages



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

def messages
  @messages
end

- (Object) params (readonly)

Returns the value of attribute params



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

def params
  @params
end

Instance Method Details

- (Object) to_s



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

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