Exception: SshTresor::Error

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

Overview

Base error class for all ssh-tresor-ruby failures.

CLI callers use #exit_code to map domain failures to stable process exit statuses.

Constant Summary collapse

EXIT_GENERAL_ERROR =
1
EXIT_AGENT_CONNECTION_FAILED =
2
EXIT_KEY_NOT_FOUND =
3
EXIT_DECRYPTION_FAILED =
4

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, exit_code: EXIT_GENERAL_ERROR) ⇒ Error

Returns a new instance of Error.

Parameters:

  • message (String)

    human-readable error message.

  • exit_code (Integer) (defaults to: EXIT_GENERAL_ERROR)

    process exit code used by the CLI.



18
19
20
21
# File 'lib/ssh_tresor/error.rb', line 18

def initialize(message, exit_code: EXIT_GENERAL_ERROR)
  super(message)
  @exit_code = exit_code
end

Instance Attribute Details

#exit_codeObject (readonly)

Returns the value of attribute exit_code.



14
15
16
# File 'lib/ssh_tresor/error.rb', line 14

def exit_code
  @exit_code
end