Method: OneApm::Support::Marshaller#parsed_error

Defined in:
lib/one_apm/support/marshaller.rb

#parsed_error(error) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/one_apm/support/marshaller.rb', line 10

def parsed_error(error)
  error_type    = error['error_type']
  error_message = error['message']

  exception = case error_type
  when 'OneApm::LicenseException'
    OneApm::LicenseException.new(error_message)
  when 'OneApm::ForceRestartException'
    OneApm::ForceRestartException.new(error_message)
  when 'OneApm::ForceDisconnectException'
    OneApm::ForceDisconnectException.new(error_message)
  else
    OneApm::Support::Marshaller::CollectorError.new("#{error['error_type']}: #{error['message']}")
  end

  exception
end