noob-dev
noob-dev

Reputation: 89

gRPC DATA_LOSS error code usage clarification

I'm working on a gRPC API that has a database with an endpoint to return a record back to the consumer. One of the columns is an enum string {X|Y|Z}. When returning the record, I reverse map the enum to an int. IF someone edits the data to maliciously insert 'M' into the column, the reverse mapping fails. In this case, what's the gRPC error code that needs to be returned? DATA_LOSS or FAILED_PRECONDITION or INTERNAL ? As per the Unrecoverable data loss or corruption.. Does this mean, data is not longer recoverable by any means or the API was not able to act based on the data it fetched from the database?

Upvotes: 0

Views: 661

Answers (1)

Margach Chris
Margach Chris

Reputation: 1749

This error comes from having a mismatch in the field numbers or fields of the protobuf file used on the client and the server.

Either you updated the client protobuf and forgot to update the server protobuf or the other way round.

Upvotes: 0

Related Questions