I have an app that wasn't written by myself. If there is an error such as an invalid ID given as a parameter, I would return something like:
"error": "The row could not be found in the database"
...but the person who wrote the application done it like so:
The row could not be found in the database
I'm unsure whether their use of a 40x code is correct here. I understand 40x codes are for client errors but isn't that in the case where the file cannot be served to the user, not that the file was found and to return a error message from the script.
Would greatly appreciate people opinions on this matter.