APIv4 - AJAX errors should say *something* useful
When calling APIv4 via AJAX, you may sometimes encounter an error. What response do you get?
Before
------
You are likely to get a completely blank response (`status=500, body=[]`).
There is no information in any of the logs (Apache, PHP, CiviCRM, etc). You
have no way to tell what's gone wrong.
Of course, if you're logged in as a full administrator, then you may have
permission `view debug output`, in which case there might be something
useful. But this won't help if you're using a less privileged user.
After
-----
For the administrator (`view debug output`), you still get a detailed error response.
For less privileged users, the error is logged. The response provides a generic message along with an
"Error ID". You can use the "Error ID" to locate information in the log.
Also, if the error is an `UnauthorizedException`, then the response code will be a semantic 403 instead of a generic 500.