class LiveIdentity::Identity::ExtendedError

Attributes

Category[R]
Error[R]
ErrorBlob[R]
ErrorBlobXML[R]

Public Class Methods

new(identity) click to toggle source
# File lib/live_identity.rb, line 542
def initialize(identity)
    @Category = nil
    @Error = nil
    @ErrorBlob = nil
    @ErrorBlobXML = nil
    hIdentity = identity.hIdentity
    pdwCategory = FFI::MemoryPointer.new(:PDWORD)
    pdwError = FFI::MemoryPointer.new(:PDWORD)
    pszErrorBlob = FFI::MemoryPointer.new(:LPWSTR)
    hr = IDCRL.GetExtendedError(hIdentity, nil, pdwCategory, pdwError, pszErrorBlob)
    raise LiveIdentityError.new(hr) if LiveIdentity::IsError?(hr)
    @Category = pdwCategory.read_uint
    @Error = pdwError.read_uint
    @ErrorBlob = read_wide_string(pszErrorBlob.read_pointer)
    @ErrorBlobXML = Nokogiri::XML(@ErrorBlob)
    LiveIdentity::FreeMemory(pszErrorBlob.read_pointer)
end

Public Instance Methods

BlobResponse() click to toggle source
# File lib/live_identity.rb, line 560
def BlobResponse
    return unless @ErrorBlobXML
    @BlobResponse ||= Nokogiri::XML(@ErrorBlobXML.xpath('/IDCRLErrorInfo/Response').first.content)
end
BlobResponseError() click to toggle source
# File lib/live_identity.rb, line 565
def BlobResponseError
    response = BlobResponse()
    reasonText        = response.xpath('//S:Fault/S:Reason/S:Text').first.content
    errorValue        = response.xpath('//S:Fault/S:Detail/psf:error/psf:value').first.content.strip.to_i(16)
    internalError     = response.xpath('//S:Fault/S:Detail/psf:error/psf:internalerror/psf:code').first.content.strip.to_i(16)
    internalErrorText = response.xpath('//S:Fault/S:Detail/psf:error/psf:internalerror/psf:text').first.content.strip
    "ReasonText:    #{reasonText}\n" +
    "ErrorValue:    #{WinCommon::Errors::HRESULT::GetNameCode(errorValue)}\n" +
    "InternalError: #{internalErrorText} #{WinCommon::Errors::HRESULT::GetNameCode(internalError)}\n"
end
to_s() click to toggle source
# File lib/live_identity.rb, line 576
def to_s
    "Category:      #{IDCRL::IDCRL_ERROR_CATEGORY.to_h[@Category]} (#{@Category})\n" +
    "Error:         #{WinCommon::Errors::HRESULT::GetNameCode(@Error)}\n" + BlobResponseError()
end