Sage35 / Products

0 stars 0 forks source link

Error Responses/Status Codes #1

Open codytjue opened 3 years ago

codytjue commented 3 years ago

https://github.com/Sage35/Products/blob/be4a4a1849ca5a16d11400626bde68064f2f1d87/index.js#L43

Great job handling errors gracefully and giving fairly descriptive error messages to the clients. Take it even further by sending specific success and error status codes along with your responses so the client has a clearer idea of the type of response they are receiving.

trentgoing commented 3 years ago

Elaborating beyond even just the idea of sending err status codes, consider how Promise chains could help you send more helpful codes back to the client. Could a .catch() method earlier in the promise chain give a different error response that better narrows down the issue observed?