mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-10 21:33:19 +00:00
Implement fast resume; refactor GetDuplicacyPreferencePath()
This commit is contained in:
@@ -160,6 +160,9 @@ const (
|
||||
otherExitCode = 101
|
||||
)
|
||||
|
||||
// This is the function to be called before exiting when an error occurs.
|
||||
var RunAtError func() = func() {}
|
||||
|
||||
func CatchLogException() {
|
||||
if r := recover(); r != nil {
|
||||
switch e := r.(type) {
|
||||
@@ -167,10 +170,12 @@ func CatchLogException() {
|
||||
if printStackTrace {
|
||||
debug.PrintStack()
|
||||
}
|
||||
RunAtError()
|
||||
os.Exit(duplicacyExitCode)
|
||||
default:
|
||||
fmt.Fprintf(os.Stderr, "%v\n", e)
|
||||
debug.PrintStack()
|
||||
RunAtError()
|
||||
os.Exit(otherExitCode)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user