brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From geom...@apache.org
Subject [5/6] brooklyn-client git commit: better error message when server returns an error
Date Thu, 27 Apr 2017 09:44:51 GMT
better error message when server returns an error

we need better error handling; this solves the thing I was wondering, which is where
was the exception coming from.


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-client/commit/2094e829
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-client/tree/2094e829
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-client/diff/2094e829

Branch: refs/heads/master
Commit: 2094e8295edbb4c8791dece188db44c3417a533a
Parents: 8f17880
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Mon Apr 24 14:38:36 2017 +0100
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Mon Apr 24 15:13:30 2017 +0100

----------------------------------------------------------------------
 cli/error_handler/error.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-client/blob/2094e829/cli/error_handler/error.go
----------------------------------------------------------------------
diff --git a/cli/error_handler/error.go b/cli/error_handler/error.go
index e1f768a..054d3ca 100644
--- a/cli/error_handler/error.go
+++ b/cli/error_handler/error.go
@@ -21,6 +21,7 @@ package error_handler
 import (
 	"fmt"
 	"os"
+        "strconv"
 	"github.com/apache/brooklyn-client/cli/net"
 )
 
@@ -32,7 +33,7 @@ func ErrorExit(errorvalue interface{}, errorcode ...int) {
 	switch errorvalue.(type) {
 	case net.HttpError:
 		httpError := errorvalue.(net.HttpError)
-		fmt.Fprintln(os.Stderr, httpError.Body)
+		fmt.Fprintln(os.Stderr, "Server error ("+strconv.Itoa(httpError.Code)+"): "+httpError.Body)
 	case error:
 		fmt.Fprintln(os.Stderr, errorvalue)
 	case string:


Mime
View raw message