Exception: UU::OS::REST::RemoteException
- Inherits:
-
StandardError
- Object
- StandardError
- UU::OS::REST::RemoteException
- Defined in:
- uu_os_framework-0.29.16/lib/uu/os/rest/remote_exception.rb
Overview
Ancestor of all exceptions thrown by RemoteClient.
Direct Known Subclasses
Defined Under Namespace
Instance Attribute Summary (collapse)
-
- (Array<UU::OS::REST::RemoteException::Attribute>) attributes
readonly
Additional exception attributes.
-
- (Array<UU::OS::REST::RemoteException::Message>) messages
readonly
Exception messages.
-
- (String) stack_trace
readonly
Sever-side stack trace.
Instance Method Summary (collapse)
-
- (RemoteException) initialize(data)
constructor
Creates new instance of RemoteException.
Constructor Details
- (RemoteException) initialize(data)
Creates new instance of RemoteException.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'uu_os_framework-0.29.16/lib/uu/os/rest/remote_exception.rb', line 31 def initialize(data) if (!data.kind_of?String) && (!data.kind_of?Hash) raise ArgumentError.new("Parameter must be String or Hash, but was #{data.class}.") end begin data = JSON.parse(data, :symbolize_names => true) if data.kind_of?String @id = data[:id] @code = data[:code] if data[:errorMessages] @messages = [] data[:errorMessages].each do |msg| @messages << Message.new(msg) end end if data[:attributes] @attributes = [] data[:attributes].each do |attr| @attributes << Attribute.new(attr) end end @stack_trace = data[:stackTrace] = '' @messages.each do |msg| << "\n" << msg.to_s end super() rescue # Response does not contain exception data serialized in valid JSON # (it is probably some infrastructure (e.g. Tomcat) exception) super(data.to_s) end end |
Instance Attribute Details
- (Array<UU::OS::REST::RemoteException::Attribute>) attributes (readonly)
Additional exception attributes.
22 23 24 |
# File 'uu_os_framework-0.29.16/lib/uu/os/rest/remote_exception.rb', line 22 def attributes @attributes end |
- (Array<UU::OS::REST::RemoteException::Message>) messages (readonly)
Exception messages.
18 19 20 |
# File 'uu_os_framework-0.29.16/lib/uu/os/rest/remote_exception.rb', line 18 def @messages end |
- (String) stack_trace (readonly)
Sever-side stack trace.
26 27 28 |
# File 'uu_os_framework-0.29.16/lib/uu/os/rest/remote_exception.rb', line 26 def stack_trace @stack_trace end |