Diagnostics errors

This gives us a switch which enables the diagnostics to log errors reported by error-catching javascript diagnostics system.