arangodb-net-standard icon indicating copy to clipboard operation
arangodb-net-standard copied to clipboard

Create enum of error numbers

Open rossmills99 opened this issue 3 years ago • 0 comments

Previously we rejected the idea of using an enum for the ArangoDB error codes, see: https://github.com/ArangoDB-Community/arangodb-net-standard/pull/15

However it would still be useful to include an enum in the repository that can be used for doing comparisons, even if the types themselves continue to use int. This could then be used in code such as:

try
{
// do stuff
}
// cast ArangoDbErrorNum to `int` for comparison
catch (ApiErrorException ex) when (ex.ApiError.ErrorNum == (int)ArangoDbErrorNum.DocumentNotFound)
{
// handle not found
}

rossmills99 avatar Sep 15 '22 09:09 rossmills99