DESCRIPTION

Create an ErrorCode class for error codes

This allows us to use error codes in other places than just
operations. This class defines all of the Memcached error codes
as well as two client specific codes (timed out and canceled). The
reason for client specific error codes is that is gives the user
something definitive to test against when error cases happen.

Change-Id: I6b4b21ec8448444103d8e73b440df6085bdc1e33


COMMENTS

author: Andreas Short
date: 2012-05-26 18:18:16.593000000

Patch Set 1: Do not submit

(3 inline comments)

This is excellent!  I'd run into this need when doing the exponential backoff, but didn't have time at the moment to add these.  

I'm sorry to -2 it, but there are a couple of things here that we should fix.  See the comments inline.

Line:181, src/main/java/net/spy/memcached/protocol/binary/OperationImpl.java -> Should there be a method that just takes errCode as a byte rather than having to do this cast?

Possible NPE here.

Line:133, src/main/java/net/spy/memcached/ops/ErrorCode.java -> The compiler may take care of it for you, but a switch would usually be more efficient.

Line:166, src/main/java/net/spy/memcached/ops/ErrorCode.java -> Are you sure we want to return null and not throw an exception?

This could easily have a unit test for known values.

-------------------------------------
author: Kenny Maynard
date: 2012-05-26 18:27:42.777000000

Patch Set 1: (3 inline comments)



Line:181, src/main/java/net/spy/memcached/protocol/binary/OperationImpl.java -> Not exactly sure what you mean here? Are you saying this function should be getStatusForErrorCode(byte, byte[])?

Line:133, src/main/java/net/spy/memcached/ops/ErrorCode.java -> I wanted to do this, but there was a strange compile error that wouldn't let me. I'll try one more time and let you know what there error was if I can't make it happen.

Line:166, src/main/java/net/spy/memcached/ops/ErrorCode.java -> I did null in case we forgot to catch something or new error code was added to memcached and we didn't catch it. I figured it might be better to let the client continue execution. An exception would cause a reconnect. I am open to changing it though if you think an exception would be better.

-------------------------------------
author: Kenny Maynard
date: 2012-06-01 22:55:55.248000000

Patch Set 1: (2 inline comments)



Line:181, src/main/java/net/spy/memcached/protocol/binary/OperationImpl.java -> ErrorCodes are shorts. I can change my code to match this.

Line:133, src/main/java/net/spy/memcached/ops/ErrorCode.java -> Error is "case expressions must be constant expressions"

In the other Enums we do things just like this.

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