noghartt / fakeddit

A Reddit clone developed as a monorepo with React + Relay + Node.js + MongoDB
35 stars 2 forks source link

Write an enum containing all error messages on `packages/server` #32

Open noghartt opened 2 years ago

daniloab commented 2 years ago

declare the error strings directly inside where it belongs. Believe me, I already did this idea of array error and I don't like, but IMO

noghartt commented 2 years ago

declare the error strings directly inside where it belongs. Believe me, I already did this idea of array error and I don't like, but IMO

I have mixed feelings about it. We can standardize the error messages that belong to the API, we have a tradeoff to turn the error message more generic and could not be conclusive.

But at the same time, I think that if we implement the "error pattern" based on RFC 7807, we could turn it more concise, basing the "generic error message" on the title property and the detailed error message on the details property. What do you think about it?

daniloab commented 2 years ago

declare the error strings directly inside where it belongs. Believe me, I already did this idea of array error and I don't like, but IMO

I have mixed feelings about it. We can standardize the error messages that belong to the API, we have a tradeoff to turn the error message more generic and could not be conclusive.

But at the same time, I think that if we implement the "error pattern" based on RFC 7807, we could turn it more concise, basing the "generic error message" on the title property and the detailed error message on the details property. What do you think about it?

Go with what makes you comfortable