Currently there is no way to get matching error code from error exception.
From my investigation:
This exception have mainly 3 "normal" fields now
debug_error_string {"created":"@1649922703.326925387","description":"Error received from peer ipv6:[::1]:3322","file":"src/core/lib/surface/call.cc","file_line":903,"grpc_message":"invalid user name or password","grpc_status":2}
details invalid user name or password
code StatusCode.UNKNOWN - it matches internal codes from GRPC, and not the code provided by server (08004)
Or in some cases
https://github.com/codenotary/immudb/blob/master/pkg/errors/map.go
I looked depper into it and i see that the proper status code is in some unparsed trailing_metadata field
(_Metadatum(key='grpc-status-details-bin', value=b'\x08\x02\x12\x1dinvalid user name or password\x1aE\n+type.googleapis.com/immudb.schema.ErrorInfo\x12\x16\n\x0508004\x12\rkey not found\x1a-\n+type.googleapis.com/immudb.schema.RetryInfo'),)
.....schema.ErrorInfo\x12\x16\n\x05------->08004<-------\x12\rkey not found\x1a-\n+type.google......
User should have easy way to catch errors and don't compare them to string by himself.
SDK should also have some generic way to deal with Exceptions, or at least map existing error codes
https://github.com/codenotary/immudb/blob/master/pkg/errors/meta.go
Currently there is no way to get matching error code from error exception.
From my investigation:
Or in some cases
https://github.com/codenotary/immudb/blob/master/pkg/errors/map.go
User should have easy way to catch errors and don't compare them to string by himself.
SDK should also have some generic way to deal with Exceptions, or at least map existing error codes
https://github.com/codenotary/immudb/blob/master/pkg/errors/meta.go