Exception: Alda::NREPLServerError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/alda-rb/error.rb

Overview

The error is raised when the Alda nREPL server returns problems. This is only available for Alda 2. See Alda::REPL#message.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, port, problems, status) ⇒ NREPLServerError

:call-seq:

new(host, port, problems, status) -> Alda::NREPLServerError

Creates a Alda::NREPLServerError object. Raises Alda::GenerationError if the current generation is not Alda 2.



73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/alda-rb/error.rb', line 73

def initialize host, port, problems, status
	Alda::GenerationError.assert_generation [:v2]
	@status = status.map { Alda::Utils.slug_to_snake _1 }
	if @status.include? :unknown_op
		super 'unknown operation'
	else
		super problems.join ?\n
	end
	@host = host
	@port = port
	@problems = problems
end

Instance Attribute Details

#hostObject (readonly)

The hostname of the nREPL server.



50
51
52
# File 'lib/alda-rb/error.rb', line 50

def host
  @host
end

#portObject (readonly)

The port of the nREPL server.



54
55
56
# File 'lib/alda-rb/error.rb', line 54

def port
  @port
end

#problemsObject (readonly)

The problems returned by the nREPL server. This is an Array of String.



59
60
61
# File 'lib/alda-rb/error.rb', line 59

def problems
  @problems
end

#statusObject (readonly)

The status returned by the nREPL server. It is an Array of Symbol. Symbols must appear are :done, :error, and there may be :unknown_op.



65
66
67
# File 'lib/alda-rb/error.rb', line 65

def status
  @status
end