Custom error handler

This branch allows users to define a custom behavior for handling exceptions raised from within a service.