Make the error handler second argument configurable