Why does the fb_app_init() function set an exception handler?

I've never actually seen it handle an exception from the FB module, rather it tends to handle uncaught exceptions coming from other modules. This leads to confusion, as most people assume its an issue with the FB module, when it very rarely is.

Now, I agree that the exception handler is a little better than the one that comes with Drupal, however, in a production site it is much, much worse. I would argue that changing the exception handler would be a better task for devel module?

Comments

Dave Cohen’s picture

If memory serves, in D6 there is no other exception handler. So some of how this works may be historical.

As it describes in the comments, ideally the exception handler would be configurable or would honor a previously defined handler. I don't think php provides a way to check whether one is already defined, but apparently you can restore the previous handler after setting one. So maybe there's some way to not trample on Drupal's default.

I don't believe it should be defined in devel, because exceptions need to be handled even on live sites where devel is disabled.

ianthomas_uk’s picture

Changing the default exception handler is no where near the functionality that I would expect a facebook module to provide. Ideally exception handling (with varying behaviour between dev and live) should be part of Core, but if you want to improve on that it should be in a separate module.

Dave Cohen’s picture

Assigned: Unassigned » Dave Cohen

Agreed. It's only there for historical reasons. I'll remove it.

Dave Cohen’s picture

Status: Active » Fixed

Pushed this.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.