Closed bengeois closed 3 weeks ago
Hey @bengeois, thanks for your work! We don't usually throw errors. Instead we return them as a Union. Can we please also do that in this section of the API?
See https://github.com/openfoodfacts/openfoodfacts-nodejs/blob/71b84960bd96da541d02470a0ecfa35b01cfb907/src/folksonomy.ts#L112 for reference.
Issues
11 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
Hey @VaiTon , thanks for your feedback!
Initially, I was using catch blocks to separate error handling logic from the standard flow. However, I've refactored the code as requested to align with the existing approach used in other wrappers, where errors are returned as a Union.
Additionally, I’ve introduced a NutriPatrolError to provide more detailed information, such as the statusCode. This allows us to maintain useful error details that would otherwise be lost if we didn't include them.
Let me know if you have any other thoughts!
Thanks @bengeois and congratulations on this first feature 👌
What
Nutripatrol API wrapper
Fix https://github.com/openfoodfacts/openfoodfacts-nodejs/issues/520