Allow setting of custom error handler