class Alda::CommandLineError
The error is raised when alda command exits with nonzero status.
Attributes
status[R]
The Process::Status object representing the status of the process that runs alda command.
Public Class Methods
new(status, msg=nil) → Alda::CommandLineError
click to toggle source
Create a Alda::CommandLineError object. status is the status of the process running alda command (can be nil). msg is the output of alda command. port info is extracted from msg in Alda 1.
Calls superclass method
# File lib/alda-rb/error.rb, line 31 def initialize status, msg = nil if Alda.v1? && msg && /^\[(?<port>\d+)\]\sERROR\s(?<message>.*)$/ =~ msg super message @port = port.to_i else super msg end @status = status end
Public Instance Methods
port()
click to toggle source
The port on which the problematic alda server runs. This is only available for Alda 1.
begin Alda[port: 1108].play code: 'y' rescue CommandLineError => e e.port # => 1108 end
# File lib/alda-rb/error.rb, line 19 def port Alda::GenerationError.assert_generation [:v1] @port end