EventStore / EventStore-Client-Go

Go Client for Event Store version 20 and above.
Apache License 2.0
105 stars 27 forks source link

Add `IsErrorCode` to Error #162

Closed yordis closed 10 months ago

yordis commented 10 months ago

Added: IsErrorCode to Error struct.

Context

Useful when we want to check the error code, I found I use it primarily for the following two (but not limited to) in the write-side,

if err, ok := esdb.FromError(err); !ok {
  if err.Code() == esdb.ErrorCodeWrongExpectedVersion {  }
  if err.Code() == esdb.ErrorCodeResourceNotFound { }
}
yordis commented 10 months ago

@YoEight, any updates here?