Commit 1aec2f9f authored by Cristian Maglie's avatar Cristian Maglie

Errors are not doubly printed anymore

parent 772c6a8d
...@@ -31,7 +31,6 @@ package formatter ...@@ -31,7 +31,6 @@ package formatter
import ( import (
"encoding/json" "encoding/json"
"errors"
"strings" "strings"
) )
...@@ -56,13 +55,16 @@ func (err ErrorMessage) MarshalJSON() ([]byte, error) { ...@@ -56,13 +55,16 @@ func (err ErrorMessage) MarshalJSON() ([]byte, error) {
// String returns a string representation of the Error. // String returns a string representation of the Error.
func (err ErrorMessage) String() string { func (err ErrorMessage) String() string {
if err.Error == nil {
return err.Message
}
return err.Message + " (" + err.Error.Error() + ")" return err.Message + " (" + err.Error.Error() + ")"
} }
// PrintErrorMessage formats and prints info about an error message. // PrintErrorMessage formats and prints info about an error message.
func PrintErrorMessage(msg string) { func PrintErrorMessage(msg string) {
msg = strings.TrimSpace(msg) msg = strings.TrimSpace(msg)
PrintError(errors.New(msg), msg) PrintError(nil, msg)
} }
// PrintError formats and prints info about an error. // PrintError formats and prints info about an error.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment