Exception: Docker::Compose::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cmd, status, detail) ⇒ Error

Returns a new instance of Error.

Parameters:

  • cmd (String)
  • status (Integer)
  • detail (String)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/docker/compose/error.rb', line 9

def initialize(cmd, status, detail)
  @status = status
  @detail = detail

  brief = detail.split(/[\r\n]+/).select { |l| !l.empty? }.first || '(no output)'

  case status
  when Numeric
    status = status.to_s
  else
    status = "'#{status}'"
  end

  message = format("'%s' failed with status %s: %s", cmd, status, brief)
  super(message)
end

Instance Attribute Details

#detailObject (readonly)

Returns the value of attribute detail.



4
5
6
# File 'lib/docker/compose/error.rb', line 4

def detail
  @detail
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/docker/compose/error.rb', line 4

def status
  @status
end