[ARVADOS] updated: dccf36ede6f880d8fcec936f684fb8d5f06771d6

Git user git at public.curoverse.com
Sun Nov 6 22:15:35 EST 2016


Summary of changes:
 services/keepstore/handlers.go | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

       via  dccf36ede6f880d8fcec936f684fb8d5f06771d6 (commit)
      from  1df4ab124c117a232c5360f6bac95d5409a5b598 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit dccf36ede6f880d8fcec936f684fb8d5f06771d6
Author: Tom Clegg <tom at curoverse.com>
Date:   Sun Nov 6 22:11:52 2016 -0500

    10467: Use ErrClientDisconnect. Convert type assertion panic to 500 error.

diff --git a/services/keepstore/handlers.go b/services/keepstore/handlers.go
index 588ee04..2c680d3 100644
--- a/services/keepstore/handlers.go
+++ b/services/keepstore/handlers.go
@@ -192,8 +192,11 @@ func PutBlockHandler(resp http.ResponseWriter, req *http.Request) {
 	bufs.Put(buf)
 
 	if err != nil {
-		ke := err.(*KeepError)
-		http.Error(resp, ke.Error(), ke.HTTPCode)
+		code := http.StatusInternalServerError
+		if err, ok := err.(*KeepError); ok {
+			code = err.HTTPCode
+		}
+		http.Error(resp, err.Error(), code)
 		return
 	}
 
@@ -572,7 +575,7 @@ func GetBlock(ctx context.Context, hash string, buf []byte, resp http.ResponseWr
 		size, err := vol.Get(ctx, hash, buf)
 		select {
 		case <-ctx.Done():
-			return 0, ctx.Err()
+			return 0, ErrClientDisconnect
 		default:
 		}
 		if err != nil {
@@ -655,7 +658,7 @@ func PutBlock(ctx context.Context, block []byte, hash string) (int, error) {
 			return vol.Replication(), nil // success!
 		}
 		if ctx.Err() != nil {
-			return 0, ctx.Err()
+			return 0, ErrClientDisconnect
 		}
 	}
 
@@ -669,7 +672,7 @@ func PutBlock(ctx context.Context, block []byte, hash string) (int, error) {
 	for _, vol := range writables {
 		err := vol.Put(ctx, hash, block)
 		if ctx.Err() != nil {
-			return 0, ctx.Err()
+			return 0, ErrClientDisconnect
 		}
 		if err == nil {
 			return vol.Replication(), nil // success!

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list