class MSGraph::Error

Error from Microsoft Graph.

Attributes

body[R]

@return [String, Hash] the parsed body of the response in JSON case,

otherwise the raw body.
error[R]

@return [Hash] the parsed error property.

response[R]

@return [Net::HTTPResponse] the HTTP response.

Public Class Methods

new(res) click to toggle source

@param [Net::HTTPResponse] res the HTTP response

Calls superclass method
# File lib/msgraph/error.rb, line 15
def initialize(res)
  @response = res
  if res.content_type&.start_with? 'application/json'
    @body = JSON.parse(res.body, symbolize_names: true)
    @error = @body[:error]
  else
    @body = res.body
  end
  super("#{res.code}: #{res.message}\n#{@body}")
end