Class: Yobi::ExitError
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- 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 =
Matches a JSON line with
"message_type": "exit_error". /"message_type"\s*:\s*"exit_error"/
Class Method Summary collapse
-
.from_output(output) ⇒ Yobi::ExitError?
nilif noexit_errorline is present.
Instance Method Summary collapse
Class Method Details
.from_output(output) ⇒ Yobi::ExitError?
Returns nil if no exit_error line is present.
18 19 20 21 |
# File 'lib/yobi/errors.rb', line 18 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?
24 25 26 |
# File 'lib/yobi/errors.rb', line 24 def code self["code"] end |
#message ⇒ String?
29 30 31 |
# File 'lib/yobi/errors.rb', line 29 def self["message"] end |