optakt / flow-dps

Flow Data Provisioning Service
Apache License 2.0
29 stars 13 forks source link

Rosetta: Moving error descriptions to the validator package #451

Closed Maelkum closed 3 years ago

Maelkum commented 3 years ago

Goal of this PR

Fixes #444

Checklist

Maelkum commented 3 years ago

Q: We could do the same in the retriever and transactor packages, who are two big "generators" of errors, and move errors strings to const there too. Do you think we should do that?

For me, the "pro" is - no magic strings scattered throughout the code, "con" - I think it's more precise and easier for the reader to see what's wrong as it is now. It's closer to a log message or a fmt.Errorf, and offers more details than a name of a const.

awfm9 commented 3 years ago

Q: We could do the same in the retriever and transactor packages, who are two big "generators" of errors, and move errors strings to const there too. Do you think we should do that?

I'm in favour of using constant strings for error types or sentinel errors. For normal errors, it's not required.