Incorrect error code returned for AlreadyExists error
michael-the-grey opened this issue · 1 comments
michael-the-grey commented
Code generated to check if the row already exists.
if err != nil {
if strings.Contains(err.Error(), "already exists") {
return nil, grpc.Errorf(codes.AlreadyExists, err.Error())
} else {
return nil, grpc.Errorf(codes.Unknown, err.Error())
}
}
Format of the AlreadyExists error.
spanner: code = "AlreadyExists", desc = "Row [<field_value>] in table <table_name>."
The code for Unknown will always be returned for AlreadyExists errors
iamneal commented
Newest version of persist no longer checks for error types at all, making this ticket not relevant anymore. I will open a ticket for better error handling as a feature