Class: OpsWalrus::Invocation::Error

Inherits:
Result
  • Object
show all
Defined in:
lib/opswalrus/ops_file_script_dsl.rb

Direct Known Subclasses

EarlyExitError, RuntimeError, SshError, UnhandledError

Constant Summary collapse

Type =
"Invocation::Error"

Instance Attribute Summary

Attributes inherited from Result

#exit_status, #value

Instance Method Summary collapse

Methods inherited from Result

#success?

Constructor Details

#initialize(value, exit_status = 1) ⇒ Error

Returns a new instance of Error.



41
42
43
# File 'lib/opswalrus/ops_file_script_dsl.rb', line 41

def initialize(value, exit_status = 1)
  super(value, exit_status == 0 ? 1 : exit_status)
end

Instance Method Details

#failure?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/opswalrus/ops_file_script_dsl.rb', line 54

def failure?
  true
end

#serialize_errorObject



44
45
46
47
48
49
50
51
52
53
# File 'lib/opswalrus/ops_file_script_dsl.rb', line 44

def serialize_error
  {
    type: Type,
    error_variant: self.class.name,
    error_class: value.class.name,
    error: value,
    backtrace: value.is_a?(Exception) ? value.backtrace.take(10).join("\n") : nil,
    exit_status: exit_status
  }
end