Centralized error handler registering, so it can be easier disabled for debug builds