From d8bb1e9fd644577486b94eb461537b70c6935ced Mon Sep 17 00:00:00 2001 From: "Anand Babu (AB) Periasamy" Date: Sat, 22 Aug 2015 23:22:17 -0700 Subject: [PATCH 1/3] replaced panic with probe --- config-main.go | 2 +- ls.go | 2 +- mirror-url.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config-main.go b/config-main.go index 40f5ef3d..754b8920 100644 --- a/config-main.go +++ b/config-main.go @@ -74,7 +74,7 @@ func (a AliasMessage) String() string { } jsonMessageBytes, err := json.Marshal(a) if err != nil { - panic(err) + fatalIf(probe.NewError(e), "Unable to marshall into JSON.") } return string(jsonMessageBytes) } diff --git a/ls.go b/ls.go index 526ef05b..b87e5e7c 100644 --- a/ls.go +++ b/ls.go @@ -58,7 +58,7 @@ func (c ContentMessage) String() string { } jsonMessageBytes, err := json.Marshal(c) if err != nil { - panic(err) + fatalIf(probe.NewError(e), "Unable to marshall into JSON.") } return string(jsonMessageBytes) } diff --git a/mirror-url.go b/mirror-url.go index 2b662550..1f6adc35 100644 --- a/mirror-url.go +++ b/mirror-url.go @@ -60,7 +60,7 @@ func (s MirrorMessage) String() string { } mirrorMessageBytes, err := json.Marshal(s) if err != nil { - panic(err) + fatalIf(probe.NewError(e), "Unable to marshall into JSON.") } return string(mirrorMessageBytes) } From 099b4478d6b643dbd4caf8cf099d40309512afd1 Mon Sep 17 00:00:00 2001 From: "Anand Babu (AB) Periasamy" Date: Sat, 22 Aug 2015 23:25:11 -0700 Subject: [PATCH 2/3] replaced panic with probe --- config-main.go | 4 ++-- ls.go | 4 ++-- mirror-url.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config-main.go b/config-main.go index 754b8920..207eeeff 100644 --- a/config-main.go +++ b/config-main.go @@ -72,8 +72,8 @@ func (a AliasMessage) String() string { message += console.Colorize("URL", fmt.Sprintf("%s", a.URL)) return message } - jsonMessageBytes, err := json.Marshal(a) - if err != nil { + jsonMessageBytes, e := json.Marshal(a) + if e != nil { fatalIf(probe.NewError(e), "Unable to marshall into JSON.") } return string(jsonMessageBytes) diff --git a/ls.go b/ls.go index b87e5e7c..0fc97db4 100644 --- a/ls.go +++ b/ls.go @@ -56,8 +56,8 @@ func (c ContentMessage) String() string { }() return message } - jsonMessageBytes, err := json.Marshal(c) - if err != nil { + jsonMessageBytes, e := json.Marshal(c) + if e != nil { fatalIf(probe.NewError(e), "Unable to marshall into JSON.") } return string(jsonMessageBytes) diff --git a/mirror-url.go b/mirror-url.go index 1f6adc35..70b14189 100644 --- a/mirror-url.go +++ b/mirror-url.go @@ -58,8 +58,8 @@ func (s MirrorMessage) String() string { if !globalJSONFlag { return fmt.Sprintf("‘%s’ -> ‘%s’", s.Source, s.Targets) } - mirrorMessageBytes, err := json.Marshal(s) - if err != nil { + mirrorMessageBytes, e := json.Marshal(s) + if e != nil { fatalIf(probe.NewError(e), "Unable to marshall into JSON.") } return string(mirrorMessageBytes) From f2899ef22888c3bdd2c9323bb09c19d37da4a8b4 Mon Sep 17 00:00:00 2001 From: "Anand Babu (AB) Periasamy" Date: Sat, 22 Aug 2015 23:26:56 -0700 Subject: [PATCH 3/3] replaced panic with probe --- config-main.go | 5 ++--- ls.go | 5 ++--- mirror-url.go | 5 ++--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/config-main.go b/config-main.go index 207eeeff..d3257530 100644 --- a/config-main.go +++ b/config-main.go @@ -73,9 +73,8 @@ func (a AliasMessage) String() string { return message } jsonMessageBytes, e := json.Marshal(a) - if e != nil { - fatalIf(probe.NewError(e), "Unable to marshall into JSON.") - } + fatalIf(probe.NewError(e), "Unable to marshall into JSON.") + return string(jsonMessageBytes) } diff --git a/ls.go b/ls.go index 0fc97db4..625fa600 100644 --- a/ls.go +++ b/ls.go @@ -57,9 +57,8 @@ func (c ContentMessage) String() string { return message } jsonMessageBytes, e := json.Marshal(c) - if e != nil { - fatalIf(probe.NewError(e), "Unable to marshall into JSON.") - } + fatalIf(probe.NewError(e), "Unable to marshall into JSON.") + return string(jsonMessageBytes) } diff --git a/mirror-url.go b/mirror-url.go index 70b14189..93da2b8c 100644 --- a/mirror-url.go +++ b/mirror-url.go @@ -59,9 +59,8 @@ func (s MirrorMessage) String() string { return fmt.Sprintf("‘%s’ -> ‘%s’", s.Source, s.Targets) } mirrorMessageBytes, e := json.Marshal(s) - if e != nil { - fatalIf(probe.NewError(e), "Unable to marshall into JSON.") - } + fatalIf(probe.NewError(e), "Unable to marshall into JSON.") + return string(mirrorMessageBytes) }