From 154c229324137b5aff714e5748cd701bdfa66a60 Mon Sep 17 00:00:00 2001 From: "Anand Babu (AB) Periasamy" Date: Sat, 22 Aug 2015 02:47:35 -0700 Subject: [PATCH] error messages update --- diff.go | 38 +++++++++++++++++++------------------- typed-errors.go | 8 ++++---- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/diff.go b/diff.go index 1690246b..afc65b4d 100644 --- a/diff.go +++ b/diff.go @@ -73,16 +73,16 @@ func doDiffInRoutine(firstURL, secondURL string, recursive bool, ch chan diff) { firstClnt, firstContent, err := url2Stat(firstURL) if err != nil { ch <- diff{ - message: "Failed to stat ‘" + firstURL + "’", - err: err.Trace(), + message: "Failed to stat ‘" + firstURL + "’.", + err: err.Trace(firstURL), } return } secondClnt, secondContent, err := url2Stat(secondURL) if err != nil { ch <- diff{ - message: "Failed to stat ‘" + secondURL + "’", - err: err.Trace(), + message: "Failed to stat ‘" + secondURL + "’.", + err: err.Trace(secondURL), } return } @@ -92,8 +92,8 @@ func doDiffInRoutine(firstURL, secondURL string, recursive bool, ch chan diff) { newSecondURL, err := urlJoinPath(secondURL, firstURL) if err != nil { ch <- diff{ - message: "Unable to construct new URL from ‘" + secondURL + "’ using ‘" + firstURL, - err: err.Trace(), + message: "Unable to construct new URL from ‘" + secondURL + "’ using ‘" + firstURL + "’.", + err: err.Trace(secondURL, firstURL), } return } @@ -138,12 +138,12 @@ func doDiffObjects(firstURL, secondURL string, ch chan diff) { switch { case errFirst != nil && errSecond == nil: ch <- diff{ - err: errFirst.Trace(), + err: errFirst.Trace(firstURL, secondURL), } return case errFirst == nil && errSecond != nil: ch <- diff{ - err: errSecond.Trace(), + err: errSecond.Trace(firstURL, secondURL), } return } @@ -186,24 +186,24 @@ func dodiff(firstClnt, secondClnt client.Client, ch chan diff) { for contentCh := range firstClnt.List(false) { if contentCh.Err != nil { ch <- diff{ - message: "Failed to list ‘" + firstClnt.URL().String() + "’", - err: contentCh.Err.Trace(), + message: "Failed to list ‘" + firstClnt.URL().String() + "’.", + err: contentCh.Err.Trace(firstClnt.URL().String()), } return } newFirstURL, err := urlJoinPath(firstClnt.URL().String(), contentCh.Content.Name) if err != nil { ch <- diff{ - message: "Unable to construct new URL from ‘" + firstClnt.URL().String() + "’ using ‘" + contentCh.Content.Name + "’", - err: err.Trace(), + message: "Unable to construct new URL from ‘" + firstClnt.URL().String() + "’ using ‘" + contentCh.Content.Name + "’.", + err: err.Trace(firstClnt.URL().String()), } return } newSecondURL, err := urlJoinPath(secondClnt.URL().String(), contentCh.Content.Name) if err != nil { ch <- diff{ - message: "Unable to construct new URL from ‘" + secondClnt.URL().String() + "’ using ‘" + contentCh.Content.Name + "’", - err: err.Trace(), + message: "Unable to construct new URL from ‘" + secondClnt.URL().String() + "’ using ‘" + contentCh.Content.Name + "’.", + err: err.Trace(secondClnt.URL().String()), } return } @@ -273,8 +273,8 @@ func dodiffRecursive(firstClnt, secondClnt client.Client, ch chan diff) { for firstContentCh := range firstClnt.List(true) { if firstContentCh.Err != nil { ch <- diff{ - message: "Failed to list ‘" + firstClnt.URL().String() + "’", - err: firstContentCh.Err.Trace(), + message: "Failed to list ‘" + firstClnt.URL().String() + "’.", + err: firstContentCh.Err.Trace(firstClnt.URL().String()), } return } @@ -287,8 +287,8 @@ func dodiffRecursive(firstClnt, secondClnt client.Client, ch chan diff) { for secondContentCh := range secondClnt.List(true) { if secondContentCh.Err != nil { ch <- diff{ - message: "Failed to list ‘" + secondClnt.URL().String() + "’", - err: secondContentCh.Err.Trace(), + message: "Failed to list ‘" + secondClnt.URL().String() + "’.", + err: secondContentCh.Err.Trace(secondClnt.URL().String()), } return } @@ -311,7 +311,7 @@ func dodiffRecursive(firstClnt, secondClnt client.Client, ch chan diff) { }(doneCh) wg.Wait() doneCh <- struct{}{} - console.PrintC("\r" + "Finished" + "\n") + console.PrintC("\r" + "Finished." + "\n") matchNameCh := make(chan string, 10000) go func(matchNameCh chan<- string) { diff --git a/typed-errors.go b/typed-errors.go index 7a4eb491..8c7dcf49 100644 --- a/typed-errors.go +++ b/typed-errors.go @@ -26,7 +26,7 @@ func (e errNotAnObject) Error() string { return "URL: ‘" + e.url + "’ not an object" } -var errInvalidArgument = errors.New("Invalid arguments provided, cannot proceed") +var errInvalidArgument = errors.New("Invalid arguments provided, cannot proceed.") type errInvalidGlobURL struct { glob string @@ -34,7 +34,7 @@ type errInvalidGlobURL struct { } func (e errInvalidGlobURL) Error() string { - return "Error reading glob URL " + e.glob + " while comparing with " + e.request + return "Error reading glob URL ‘" + e.glob + "’ while comparing with ‘" + e.request + "’." } type errNoMatchingHost struct { @@ -42,7 +42,7 @@ type errNoMatchingHost struct { } func (e errNoMatchingHost) Error() string { - return "No matching host found for the given url ‘" + e.url + "’" + return "No matching host found for the given url ‘" + e.url + "’." } type errInitClient struct { @@ -50,7 +50,7 @@ type errInitClient struct { } func (e errInitClient) Error() string { - return "Unable to initialize client for url ‘" + e.url + "’" + return "Unable to initialize client for url ‘" + e.url + "’." } type errInvalidURL struct {