class Fontina::Windows::Win32::Error

Attributes

code[R]

Public Class Methods

check(code) click to toggle source
# File lib/fontina/windows/win32/error.rb, line 27
def check(code)
  raise new code unless ERROR_SUCCESS == code
end
check_hr(code) click to toggle source
# File lib/fontina/windows/win32/error.rb, line 31
def check_hr(code)
  raise new code unless 0 == code[31]
end
check_last() click to toggle source
# File lib/fontina/windows/win32/error.rb, line 23
def check_last
  check Kernel32.GetLastError()
end
clear() click to toggle source
# File lib/fontina/windows/win32/error.rb, line 35
def clear
  Kernel32.SetLastError(ERROR_SUCCESS)
end
new(code) click to toggle source
# File lib/fontina/windows/win32/error.rb, line 6
def initialize(code)
  @code = code
end
raise_last() click to toggle source
# File lib/fontina/windows/win32/error.rb, line 19
def raise_last
  raise new Kernel32.GetLastError()
end

Public Instance Methods

to_s() click to toggle source
# File lib/fontina/windows/win32/error.rb, line 10
def to_s
  @message ||= begin
    Kernel32.FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, code, 1024).rstrip
  rescue Error
    '0x%04x' % code
  end
end