Exception: COM::Error

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/com/error.rb

Overview

Superclass for COM-related errors. This class is meant to be subclassed an used for refinement of otherwise very unspecific COM errors.

See Also:

Direct Known Subclasses

MethodInvocationError

Class Method Summary collapse

Class Method Details

.from(error, backtrace = nil) ⇒ Object

Creates a COM::Error from error, with optional backtrace. Error should be an error raised by WIN32OLE.

This is an internal method.

Parameters:

  • error (WIN32OLERuntimeError)

    The error to create a new one from

  • backtrace (Array<String>, nil) (defaults to: nil)

    The backtrace to use for the new error



17
18
19
20
21
# File 'lib/com/error.rb', line 17

def from(error, backtrace = nil)
  errors.find{ |replacement| replacement.replaces? error }.replace(error).tap{ |e|
    e.set_backtrace backtrace if backtrace
  }
end

.replaces?(error) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/com/error.rb', line 24

def replaces?(error)
  true
end