Extract handlers setting outside try/catch

Avoids situation where some weird error setting handlers causes a report
of being unable to load the file
Expose pluginManager to enabled plugins
Merge branch 'feature-expose-api' into dev