Refactored error handler out of default implementation and added as utility instead