diff --git a/config-main.go b/config-main.go index 40f5ef3d..d3257530 100644 --- a/config-main.go +++ b/config-main.go @@ -72,10 +72,9 @@ func (a AliasMessage) String() string { message += console.Colorize("URL", fmt.Sprintf("%s", a.URL)) return message } - jsonMessageBytes, err := json.Marshal(a) - if err != nil { - panic(err) - } + jsonMessageBytes, e := json.Marshal(a) + fatalIf(probe.NewError(e), "Unable to marshall into JSON.") + return string(jsonMessageBytes) } diff --git a/ls.go b/ls.go index 526ef05b..625fa600 100644 --- a/ls.go +++ b/ls.go @@ -56,10 +56,9 @@ func (c ContentMessage) String() string { }() return message } - jsonMessageBytes, err := json.Marshal(c) - if err != nil { - panic(err) - } + jsonMessageBytes, e := json.Marshal(c) + fatalIf(probe.NewError(e), "Unable to marshall into JSON.") + return string(jsonMessageBytes) } diff --git a/mirror-url.go b/mirror-url.go index 2b662550..93da2b8c 100644 --- a/mirror-url.go +++ b/mirror-url.go @@ -58,10 +58,9 @@ func (s MirrorMessage) String() string { if !globalJSONFlag { return fmt.Sprintf("ā€˜%s’ -> ā€˜%s’", s.Source, s.Targets) } - mirrorMessageBytes, err := json.Marshal(s) - if err != nil { - panic(err) - } + mirrorMessageBytes, e := json.Marshal(s) + fatalIf(probe.NewError(e), "Unable to marshall into JSON.") + return string(mirrorMessageBytes) }