-
Denis Laxalde authored
This view will be selected upon any exception which is a subclass of cubicweb.web.RequestError when the request has Accept:application/json. Previously, the "generic_error" view would have been called, but it cannot accurately handle CubicWeb's web exceptions (it always returns 500, whereas these web exceptions may have a different status code). Why are these views selected? This is because the RootResource matches for any request with this Accept:application/json header. (In fact, we'd want to use this error view only when the request comes from a sub-resource of the RootResource; but that's not easy to achieve.) So this new error view convert a cubicweb.web.RequestError into an application/problem+json response. This is thus not backward compatible with what CubicWeb would return. In added test, we use the "format_date" "ajax" controller (of CubicWeb) with missing argument which then responds with a RemoteCallFailed (with a 500 status) that is called by our view.
1db2dd27c01e