Class: Yobi::ExitError
- Defined in:
- lib/yobi/errors.rb,
sig/yobi.rbs
Overview
The exit_error message from a fatal Restic run, if one was printed.
See https://restic.readthedocs.io/en/stable/075_scripting.html#exit-errors.
Constant Summary collapse
- LINE_PATTERN =
:nodoc:
/"message_type"\s*:\s*"exit_error"/
Class Method Summary collapse
-
.from_output(output) ⇒ ExitError?
Builds an ExitError from a Yobi::ResticOutput, or
nilif noexit_errorline is present in it.
Instance Method Summary collapse
-
#code ⇒ String?
Restic's own
exit_errorcode String, if present. -
#message ⇒ String?
Restic's own
exit_errormessage String, if present.
Methods inherited from FancyHash
#initialize, #inspect, #pretty_print
Constructor Details
This class inherits a constructor from Yobi::FancyHash
Class Method Details
.from_output(output) ⇒ ExitError?
Builds an ExitError from a Yobi::ResticOutput, or nil if no
exit_error line is present in it.
16 17 18 19 |
# File 'lib/yobi/errors.rb', line 16 def self.from_output(output) line = output.each_line.find { |candidate| LINE_PATTERN.match?(candidate) } new(JSON.parse(line)) if line end |
Instance Method Details
#code ⇒ String?
Restic's own exit_error code String, if present.
22 23 24 |
# File 'lib/yobi/errors.rb', line 22 def code self["code"] end |
#message ⇒ String?
Restic's own exit_error message String, if present.
27 28 29 |
# File 'lib/yobi/errors.rb', line 27 def self["message"] end |