Exception: MIDICommunicationsWindows::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/midi-communications-windows/api.rb

Overview

Raised when a WinMM call reports a failure.

WinMM reports errors as MMRESULT codes rather than by any out-of-band mechanism, so every call is checked and a failure becomes an exception at the point of the call, carrying the text WinMM itself gives for the code.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation, code, text = nil) ⇒ Error

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Error.

Parameters:

  • operation (Symbol) —

    the WinMM function that failed

  • code (Integer, nil) —

    the MMRESULT code, if there was one

  • text (String, nil) (defaults to: nil) —

    a description of the failure



22
23
24
25
26
27
# File 'lib/midi-communications-windows/api.rb', line 22

def initialize(operation, code, text = nil)
  @operation = operation
  @code = code

  super(build_message(operation, code, text))
end

Instance Attribute Details

#code ⇒ Integer? (readonly)

Returns the MMRESULT WinMM returned, or nil for a failure WinMM did not report as a code — a call that never completed, for instance.

Returns:

  • (Integer, nil) —

    the MMRESULT WinMM returned, or nil for a failure WinMM did not report as a code — a call that never completed, for instance



16
17
18
# File 'lib/midi-communications-windows/api.rb', line 16

def code
  @code
end

#operation ⇒ Object (readonly)



16
# File 'lib/midi-communications-windows/api.rb', line 16

attr_reader :code, :operation