You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by cb...@apache.org on 2018/04/26 06:55:49 UTC

[incubator-openwhisk-client-go] branch tid updated (4f1b2fa -> 99c3069)

This is an automated email from the ASF dual-hosted git repository.

cbickel pushed a change to branch tid
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-client-go.git.


 discard 4f1b2fa  Parse numbers correctly in error response.
     new 99c3069  Parse numbers correctly in error response.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (4f1b2fa)
            \
             N -- N -- N   refs/heads/tid (99c3069)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 whisk/client.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
To stop receiving notification emails like this one, please contact
cbickel@apache.org.

[incubator-openwhisk-client-go] 01/01: Parse numbers correctly in error response.

Posted by cb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cbickel pushed a commit to branch tid
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-client-go.git

commit 99c306968c8550e9c3aa19358a261976438bba8d
Author: Christian Bickel <cb...@de.ibm.com>
AuthorDate: Thu Apr 26 08:44:50 2018 +0200

    Parse numbers correctly in error response.
---
 whisk/client.go | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/whisk/client.go b/whisk/client.go
index 85ac505..22a764a 100644
--- a/whisk/client.go
+++ b/whisk/client.go
@@ -514,11 +514,14 @@ func parseErrorResponse(resp *http.Response, data []byte, v interface{}) (*http.
 	Debug(DbgInfo, "HTTP failure %d + body\n", resp.StatusCode)
 
 	// Determine if an application error was received (#5)
-	errorResponse := &ErrorResponse{Response: resp}
-	err := json.Unmarshal(data, errorResponse)
+    buf := bytes.NewBuffer(data)
+    d := json.NewDecoder(buf)
+    d.UseNumber()
+
+    errorResponse := &ErrorResponse{Response: resp}
 
 	// Determine if error is an application error or an error generated by API
-	if err == nil {
+    if err := d.Decode(&errorResponse); err != nil {
 		if errorResponse.Code == nil /*&& errorResponse.ErrMsg != nil */ && resp.StatusCode == 502 {
 			return parseApplicationError(resp, data, v)
 		} else if errorResponse.Code != nil && errorResponse.ErrMsg != nil {
@@ -529,7 +532,7 @@ func parseErrorResponse(resp *http.Response, data []byte, v interface{}) (*http.
 	}
 
 	// Body contents are unknown (#6)
-	Debug(DbgError, "HTTP response with unexpected body failed due to contents parsing error: '%v'\n", err)
+//	Debug(DbgError, "HTTP response with unexpected body failed due to contents parsing error: '%v'\n", err)
 	errMsg := wski18n.T("The connection failed, or timed out. (HTTP status code {{.code}})",
 		map[string]interface{}{"code": resp.StatusCode})
 	whiskErr := MakeWskError(errors.New(errMsg), resp.StatusCode-256, DISPLAY_MSG, NO_DISPLAY_USAGE)

-- 
To stop receiving notification emails like this one, please contact
cbickel@apache.org.