class MSIDP::Error
Error
from Microsoft identity platform.
Attributes
body[R]
@return [String, Hash] the parsed body of the HTTP response in JSON case,
otherwise the raw body.
description[R]
@return [String] the error description
error[R]
@return [String] the error code
response[R]
@return [Net::HTTPResponse] the HTTP response
Public Class Methods
new(response)
click to toggle source
@param [Net::HTTPResponse] response the HTTP response
Calls superclass method
# File lib/msidp/error.rb, line 17 def initialize(response) @response = response if response.content_type&.start_with? 'application/json' @body = JSON.parse(response.body, symbolize_names: true) @error = @body[:error] @description = @body[:error_description] super(<<-"MSG" #{response.code}: #{response.message} #{@error}: #{@description} MSG ) else @body = response.body super(<<-"MSG" #{response.code}: #{response.message} #{@body} MSG ) end end