Core: Error handling is bad for controllers parsing internal api calls

Created on 10 Feb 2017  路  4Comments  路  Source: flarum/core

Bug report

  • Version of Flarum: current dev-master

Pages that parse data by calling on any API endpoint and pushing them into a view for displaying are not handling errors properly with debug on. For instance if any extension produces a 500 internal server error during development, these errors will only produce a white page. The behavior we should expect is that the error is directed towards the view too.

An example of this has happened while assisting @jordanjay29 I've recalled this happened with me before too. A good way to reproduce is create a bad query in any of the listeners that modify the Discussion index (ConfigureDiscussionSearch for instance). The only way to identify the underlying issue is by dumping the $document variable in the getView method of the Forum IndexController.

Feel free to ask for more information if required.

typbug

All 4 comments

Yes I've been caught out by this too in the past. Thanks for the report.

@franzliedke hope you don't mind I assigned this to next release, feel free to push to stable. I do feel this blocks extension developers immensely, so hence the milestone.

Yeah I spent 2 hours trying to find an error by moving var_dump($var); die(); around in the code until I found where the error was occurring. Extremely tedious, only to find a method wanted an array and I was supplying a string.

Yep, I will fix this soon.

Was this page helpful?
0 / 5 - 0 ratings