delta / dalal-street-server

Server for Pragyan's Dalal Street
72 stars 16 forks source link

Cleaning up error handling part of the API #57

Open thakkarparth007 opened 6 years ago

thakkarparth007 commented 6 years ago

Currently the server returns both gRPC errors and custom errors. Need to find a better way, or need to document the exact form of error handling.

Currently the server will return grpc.UNAUTHENTICATED error if the request doesn't have a valid session id metadata set, and grpc.INTERNAL_ERROR sometimes.

Most of the times it returns grpc.STATUS_OK, with custom error inside the Response object. This is bad.

Either we should return grpc's error codes entirely, with error message string. Or have a clear division of errors.

thakkarparth007 commented 6 years ago

Let's just remove those stupid status codes, and simply use gRPC status codes. That seems to be the convention, and from what I see, the extra wrapped status codes in the responses are only a hassel. They add no value - the client only needs to know if the error was in the user initiated action, or if the server messed up. Other than this it just needs the error message to be displayed.