Exception: GroupDocsEditorCloud::ApiClientError
- Inherits:
-
StandardError
- Object
- StandardError
- GroupDocsEditorCloud::ApiClientError
- Defined in:
- lib/groupdocs_editor_cloud/api_client_error.rb
Overview
ApiClientError class for error handling
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(arg = nil) ⇒ ApiClientError
constructor
Usage examples: ApiClientError.new ApiClientError.new(:code => 500, :response_body => “”).
Constructor Details
#initialize(arg = nil) ⇒ ApiClientError
Usage examples:
ApiClientError.new
ApiClientError.new(:code => 500, :response_body => "")
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 65 66 67 68 69 |
# File 'lib/groupdocs_editor_cloud/api_client_error.rb', line 37 def initialize(arg = nil) if arg.is_a? Hash if arg.key?(:response_body) then data = JSON.parse(arg[:response_body], :symbolize_names => true) if !data.nil? then if !data[:error].nil? then error = data[:error] if error.kind_of?(String) then @message = error else @message = error[:message] end else = data[:message] if !.nil? && .kind_of?(String) then @message = @code = data[:code] else @message = data end end end end if arg.key?(:arg) then @code = arg[:Code] end else super arg end end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
31 32 33 |
# File 'lib/groupdocs_editor_cloud/api_client_error.rb', line 31 def code @code end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
32 33 34 |
# File 'lib/groupdocs_editor_cloud/api_client_error.rb', line 32 def @message end |