Added panicked attribute to context.go

This attribute is set to false during initalisation, and it's set to
true when error arises.
This commit is contained in:
Simon Aquino
2014-08-16 11:38:17 +00:00
parent 1f2ddca32b
commit cdd34b4759

View File

@@ -24,6 +24,7 @@ import (
type AptlyContext struct {
flags *flag.FlagSet
configLoaded bool
panicked bool
progress aptly.Progress
downloader aptly.Downloader
@@ -58,6 +59,7 @@ func Fatal(err error) {
if err == commander.ErrFlagError || err == commander.ErrCommandError {
returnCode = 2
}
context.panicked = true
panic(&FatalError{ReturnCode: returnCode, Message: err.Error()})
}
@@ -273,6 +275,7 @@ func InitContext(flags *flag.FlagSet) error {
context = &AptlyContext{
flags: flags,
panicked: false,
dependencyOptions: -1,
publishedStorages: map[string]aptly.PublishedStorage{},
}