omines / datatables-bundle

DataTables bundle for Symfony
https://omines.github.io/datatables-bundle/
MIT License
255 stars 114 forks source link

Option to handle 500 requests. #98

Closed olvenmage closed 4 years ago

olvenmage commented 4 years ago

Datatables normally has an option under ajax called "error" in which you can handle errors. I would like to somehow configure this since we use oauth to send our requests, but this can throw an error (such as the token being revoked). Can we get an option to handle 500's?

I can obviously configure this manually for every datatable, but I would like some global way of altering the options. Maybe just a service decorator that mutates the options?

curry684 commented 4 years ago

This bundle is not opinionated on the client side of handling errors, if only because an unauthenticated request should return a 403 response, not 500. I would recommend wrapping your client-side datatable code to perform global initialization duties.