class Alda::CommandLineError

The error is raised when alda command exits with nonzero status.

Attributes

port[R]

The port on which the problematic alda server runs.

begin
  Alda[port: 1108].play code: 'y'
rescue CommandLineError => e
  e.port # => 1108
end
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. msg is output of alda command. port# info is extracted from msg.

Calls superclass method
# File lib/alda-rb/error.rb, line 27
def initialize status, msg = nil
  if match = msg&.match(/^\[(?<port>\d+)\]\sERROR\s(?<message>.*)$/)
    super match[:message]
    @port = match[:port].to_i
  else
    super msg
    @port = nil
  end
  @status = status
end