Exception: RKSeal::CommandError

Inherits:
Error
  • Object
show all
Defined in:
lib/rkseal/errors.rb

Overview

An external command ran but exited non-zero. Carries the command label, exit status, and captured stderr so callers can surface a useful message without re-deriving them.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, command: nil, status: nil, stderr: nil) ⇒ CommandError

Returns a new instance of CommandError.

Parameters:

  • message (String) (defaults to: nil)

    human-readable summary.

  • command (String, nil) (defaults to: nil)

    command label.

  • status (Integer, nil) (defaults to: nil)

    exit status.

  • stderr (String, nil) (defaults to: nil)

    captured stderr.



40
41
42
43
44
45
# File 'lib/rkseal/errors.rb', line 40

def initialize(message = nil, command: nil, status: nil, stderr: nil)
  @command = command
  @status = status
  @stderr = stderr
  super(message)
end

Instance Attribute Details

#commandString (readonly)

Returns human label for the command (e.g. “kubeseal seal”).

Returns:

  • (String)

    human label for the command (e.g. “kubeseal seal”).



30
31
32
# File 'lib/rkseal/errors.rb', line 30

def command
  @command
end

#statusInteger? (readonly)

Returns process exit status, if one was produced.

Returns:

  • (Integer, nil)

    process exit status, if one was produced.



32
33
34
# File 'lib/rkseal/errors.rb', line 32

def status
  @status
end

#stderrString? (readonly)

Returns captured stderr (already scrubbed of secrets).

Returns:

  • (String, nil)

    captured stderr (already scrubbed of secrets).



34
35
36
# File 'lib/rkseal/errors.rb', line 34

def stderr
  @stderr
end