aptly exits with 2 on command/flag parse error. #52

This commit is contained in:
Andrey Smirnov committed 2014-05-16 00:22:51 +04:00
1 parent 2cbb486f6b
commit 05a42f4cba
40 files changed
+104 -32

No files matched your search

+6 -1
View File
@@ -9,6 +9,7 @@ import (
"github.com/smira/aptly/files"
"github.com/smira/aptly/http"
"github.com/smira/aptly/utils"
"github.com/smira/commander"
"github.com/smira/flag"
"os"
"path/filepath"
@@ -48,7 +49,11 @@ type FatalError struct {
// Fatal panics and aborts execution with exit code 1
func Fatal(err error) {
panic(&FatalError{ReturnCode: 1, Message: err.Error()})
returnCode := 1
if err == commander.ErrFlagError || err == commander.ErrCommandError {
returnCode = 2
}
panic(&FatalError{ReturnCode: returnCode, Message: err.Error()})
}
// Config loads and returns current configuration