Exception: SkyZabbix::Jsonrpc::Error::BatchError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/sky_zabbix/jsonrpc/errors.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors, result) ⇒ BatchError

Returns a new instance of BatchError.

Parameters:

  • errors (Array<Error>)

    is list of error.

  • result (Array<Any>)

    is list of response.


33
34
35
36
# File 'lib/sky_zabbix/jsonrpc/errors.rb', line 33

def initialize(errors, result)
  @errors = errors
  @result = result
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors


37
38
39
# File 'lib/sky_zabbix/jsonrpc/errors.rb', line 37

def errors
  @errors
end

#resultObject (readonly)

Returns the value of attribute result


37
38
39
# File 'lib/sky_zabbix/jsonrpc/errors.rb', line 37

def result
  @result
end

Class Method Details

.error?(body) ⇒ Boolean

Parameters:

  • Array<Hash<String (Array<Hash<String => Any>] body is response body.)

    > Any>] body is response body.

Returns:

  • (Boolean)

46
47
48
# File 'lib/sky_zabbix/jsonrpc/errors.rb', line 46

def self.error?(body)
  return body.any?{|x|x['error']}
end

Instance Method Details

#messageString

Returns error message.

Returns:

  • (String)

    error message


40
41
42
# File 'lib/sky_zabbix/jsonrpc/errors.rb', line 40

def message
  return errors.map(&:message).join(', ')
end