class Fluent::Win32Error

Constants

WSABASEERR

Attributes

errcode[R]
msg[R]

Public Class Methods

new(errcode, msg = nil) click to toggle source
# File lib/fluent/plugin/file_wrapper.rb, line 57
def initialize(errcode, msg = nil)
  @errcode = errcode
  @msg = msg
end

Public Instance Methods

==(other) click to toggle source
# File lib/fluent/plugin/file_wrapper.rb, line 81
def ==(other)
  return false if other.class != Win32Error
  @errcode == other.errcode && @msg == other.msg
end
format_english_message(errcode) click to toggle source
# File lib/fluent/plugin/file_wrapper.rb, line 62
def format_english_message(errcode)
  buf = 0.chr * 260
  flags = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY
  english_lang_id = 1033 # The result of MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)
  FormatMessageA.call(flags, 0, errcode, english_lang_id, buf, buf.size, 0)
  buf.force_encoding(Encoding.default_external).strip
end
inspect() click to toggle source
# File lib/fluent/plugin/file_wrapper.rb, line 77
def inspect
  "#<#{to_s}>"
end
to_s() click to toggle source
Calls superclass method
# File lib/fluent/plugin/file_wrapper.rb, line 70
def to_s
  msg = super
  msg << ": code: #{@errcode}, #{format_english_message(@errcode)}"
  msg << " - #{@msg}" if @msg
  msg
end
wsaerr?() click to toggle source
# File lib/fluent/plugin/file_wrapper.rb, line 86
def wsaerr?
  @errcode >= WSABASEERR
end