1
0
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:
Gilbert Chen
2017-06-22 22:53:33 -04:00
parent 839be6094f
commit d0c376f593
12 changed files with 393 additions and 146 deletions

View File

@@ -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)
}
}