You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 26, 2020. It is now read-only.
As pr #116 revealed. We need to address how error and exception handling should be done in the new media manager. Only on client side or server side and client side or only server side. We need to define a procedure for the following errors:
PHP errors
Exceptions
Invalid data
Javascript errors
The text was updated successfully, but these errors were encountered:
Imho errors should be handled on both client and server.
In the context of an api the server catches exceptions and transforms it to a proper http response with the correct http status code and an optional message.
The client picks up that status code and shows the error to the user (in most cases its best to show the already translated error message from the server response).
The most important status codes for us are:
Validation errors: 422 (including an errors array which describes the validation errors).
Authentication/Authorization errors: 401/403
Invalid arguments: 422 most of the time (sometimes 400 for bad requests)
Bad requests: 400
Internal Server errors: 500
Otherwise the server returns 200, 201 & 202 (rarely 204) depending on the context.
What do we do with exceptions which should not break the whole request? For example when we fetch image data here and it throws an exception. The whole request aborts and no data is represented on the client. Here it would be possible to just show a warning to the user.
Also with PHP error messages (notices, waringins and errors), they make the JSON response invalid. I suggest to add here an exception handler to catch them and transform them into exceptions.
As pr #116 revealed. We need to address how error and exception handling should be done in the new media manager. Only on client side or server side and client side or only server side. We need to define a procedure for the following errors:
The text was updated successfully, but these errors were encountered: