-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow hook exit codes to control backup execution (e.g fail, sk…
…ip, etc)
- Loading branch information
1 parent
e96f403
commit c4ae5b3
Showing
23 changed files
with
723 additions
and
286 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package hook | ||
|
||
import "fmt" | ||
|
||
// HookErrorCancel requests that the calling operation cancel itself. It must be handled explicitly caller. Subsequent hooks will be skipped. | ||
type HookErrorRequestCancel struct { | ||
Err error | ||
} | ||
|
||
func (e HookErrorRequestCancel) Error() string { | ||
return fmt.Sprintf("cancel: %v", e.Err.Error()) | ||
} | ||
|
||
func (e HookErrorRequestCancel) Unwrap() error { | ||
return e.Err | ||
} | ||
|
||
// HookErrorFatal stops evaluation of subsequent hooks and will propagate to the hook flow's caller | ||
type HookErrorFatal struct { | ||
Err error | ||
} | ||
|
||
func (e HookErrorFatal) Error() string { | ||
return fmt.Sprintf("fatal: %v", e.Err.Error()) | ||
} | ||
|
||
func (e HookErrorFatal) Unwrap() error { | ||
return e.Err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.