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.
https://restic.readthedocs.io/en/stable/075_scripting.html#exit-errors
Constant Summary collapse
- LINE_PATTERN =
/"message_type"\s*:\s*"exit_error"/
Class Method Summary collapse
-
.from_output(output) ⇒ Yobi::ExitError?
nilif noexit_errorline is present.
Instance Method Summary collapse
Methods inherited from FancyHash
#initialize, #inspect, #pretty_print
Constructor Details
This class inherits a constructor from Yobi::FancyHash
Class Method Details
.from_output(output) ⇒ Yobi::ExitError?
Returns nil if no exit_error line is present.
17 18 19 20 |
# File 'lib/yobi/errors.rb', line 17 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?
23 24 25 |
# File 'lib/yobi/errors.rb', line 23 def code self["code"] end |
#message ⇒ String?
28 29 30 |
# File 'lib/yobi/errors.rb', line 28 def self["message"] end |