MicahWW / Money-Tracking-Functions

The backend to a service to help track how one's money is being spent
0 stars 0 forks source link

HTTP Error Codes #11

Open codyswanner opened 5 months ago

codyswanner commented 5 months ago

Error code 515 is used for instances where information was provided improperly/not provided at all in Visualize.cs. Is this a server error, or a client error? If it is a client error, should these be 400-level error codes rather than 500-level error codes? In the cases of info not provided (correctly) maybe it would be appropriate to use error 406 Not Acceptable, or another custom 4xx status code.

MicahWW commented 5 months ago

Yes, at some point we will need to have all of these documented and in the right code range. As azure functions does return some error codes for when it runs into its own issues I want to try to not use any error codes that it uses. So we'll need to figure out everything azure functions uses, document that, then write and document error codes that the program should return.

codyswanner commented 5 months ago

Avoiding overlaps with error codes seems like overkill for production, although I can understand that methodology for development/debugging. I'd be interested in taking on an effort to ensure all the errors in code that we control has specifiers beyond the error code itself, which is often not specific enough for debugging and is sometimes not specific enough for even savvy users to understand how they could self-mitigate the error.

Should this issue be moved from "question" label to "documentation" label?

MicahWW commented 5 months ago

If we end up running into a situation where returning 401 or 403 (just examples) makes the most sense and Azure Functions also uses those then it will be fine to use those. The main idea of trying not to overlap codes is if we want to return a code and we're just trying to pick a code at random then we should try to use one that isn't being used by Azure Functions.

Yes, this will end up being a documentation issue to solve at some point.

MicahWW commented 5 months ago

With the addition of Swagger in #21 this will start to be standardized.

MicahWW commented 4 months ago

At the time of writing, only 2 different ways that return with status codes happen, OkObjectResult & ErrorResponse. This should be kept to as when starting to tackle the issue it will become easier to find all the places that need to be updated.