Exception: Yobi::Cancelled

Inherits:
Error
  • Object
show all
Defined in:
lib/yobi/errors.rb,
sig/yobi.rbs

Overview

Raised when a run was stopped through a Yobi::Cancellation token.

Distinct from Yobi::ResticExecutionError and its subclasses: the run did not fail, the caller stopped it on purpose. Rescue this to record a cancellation without treating it as a backup failure.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(execution) ⇒ Cancelled

:nodoc:

Parameters:

  • execution (cancelled_execution)


55
56
57
58
# File 'lib/yobi/errors.rb', line 55

def initialize(execution) # :nodoc:
  @execution = execution
  super("Restic run was cancelled")
end

Instance Attribute Details

#executioncancelled_execution (readonly)

The raw {exit_code:, output:, argv:} result. exit_code: and output: are nil when the token was already cancelled before Restic was spawned at all.

Returns:

  • (cancelled_execution)


53
54
55
# File 'lib/yobi/errors.rb', line 53

def execution
  @execution
end

Instance Method Details

#argvArray[String]

The argv of the run that was cancelled.

Returns:

  • (Array[String])


61
62
63
# File 'lib/yobi/errors.rb', line 61

def argv
  execution[:argv]
end

#before_start?Boolean

True when the token was cancelled before Restic even started.

Returns:

  • (Boolean)


66
67
68
# File 'lib/yobi/errors.rb', line 66

def before_start?
  execution[:exit_code].nil?
end