Create adequate error codes


Current state of error reporting makes dgraph totally inconvenient to build reliable error-prone applications.

Some messages have codes ("‘429 Too Many Requests. Please throttle your requests’"), but as part of message, so you have to extract code first and only then process it.

Other error messages - doesn’t have any stable/reliable text-part to pass through error handlers to let application decide what to do next without regexping it.

As for now I:

  • don’t know full list of error messages to handle (cannot guarantee 100% error handling)
  • don’t know if texts of messages will be changed in nearest build


Enumerate errors, assign status codes 2xx, 3xx, 4xx, 5xx (yes, it will be nice to have internal errors shown with codes) to let developers make proper error-handling based on error code, not on the phrase (‘C’ vibes).

  • Every code assigned should never change (high risk of breaking change)
  • Every code should be listed on dedicated documentation page (and as ENUMs in official clients)
  • Codes for popular/common variations of ErrorInvalidRequest should differ from each other

It will be huge step to enterprise-readiness :slight_smile:

Dgraph metadata

dgraph version

Dgraph version : v21.12.0
Dgraph codename : zion
Dgraph SHA-256 : 078c75df9fa1057447c8c8afc10ea57cb0a29dfb22f9e61d8c334882b4b4eb37
Commit SHA-1 : d62ed5f15
Commit timestamp : 2021-12-02 21:20:09 +0530
Branch : HEAD
Go version : go1.17.3
jemalloc enabled : true