Merge pull request #830 from harshavardhana/pr_out_attempt_to_make_informational_message_a_structure

This commit is contained in:
Harshavardhana
2015-06-22 07:46:33 -07:00
3 changed files with 25 additions and 9 deletions
+7 -1
View File
@@ -260,8 +260,14 @@ func runCopyCmd(ctx *cli.Context) {
}
if cps.Done {
if err := saveSession(s); err != nil {
console.Fatalln(iodine.ToError(err))
console.Fatals(ErrorMessage{
Message: "Failed with",
Error: iodine.ToError(err),
})
}
console.Infos(InfoMessage{
Message: "\nSession terminated. To resume session type ‘mc session resume " + s.SessionID + "’",
})
// this os.Exit is needed really to exit in-case of "os.Interrupt"
os.Exit(0)
}
+7 -2
View File
@@ -256,9 +256,14 @@ func runSyncCmd(ctx *cli.Context) {
}
if ss.Done {
if err := saveSession(s); err != nil {
console.Fatalln(iodine.ToError(err))
console.Fatals(ErrorMessage{
Message: "Failed wtih",
Error: iodine.ToError(err),
})
}
console.Infoln("\nSession terminated. To resume session type ‘mc session resume " + s.SessionID + "’")
console.Infos(InfoMessage{
Message: "\nSession terminated. To resume session type ‘mc session resume " + s.SessionID + "’",
})
// this os.Exit is needed really to exit in-case of "os.Interrupt"
os.Exit(0)
}
+11 -6
View File
@@ -24,8 +24,8 @@ import (
// ErrorMessage container for message reason encapsulation
type ErrorMessage struct {
Message string
Error error
Message string `json:"message"`
Error error `json:"error"`
}
func (e ErrorMessage) String() string {
@@ -45,10 +45,10 @@ func (e ErrorMessage) String() string {
// Content container for content message structure
type Content struct {
Filetype string `json:"ContentType"`
Time string `json:"LastModified"`
Size string `json:"Size"`
Name string `json:"Name"`
Filetype string `json:"content-type"`
Time string `json:"last-modified"`
Size string `json:"size"`
Name string `json:"name"`
}
func (c Content) String() string {
@@ -62,3 +62,8 @@ func (c Content) String() string {
}()
return message
}
// InfoMessage container for informational messages
type InfoMessage struct {
Message string `json:"message"`
}