EventStore / EventStore-Client-Go

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

Add `IsErrorCode` to Error #162

Closed yordis closed 7 months ago

yordis commented 8 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 7 months ago

@YoEight, any updates here?