code: def _exception_handler(self, e):
          
          if isinstance(e.message, dict):
              return self._prep_response(
                  e.message['msg'], status=e.message['status'])
          if e.message.find('Validation') == 0:
              return self._prep_response(self.validation.errors, status=400)
          elif e.message.find('No record') == 0:
              return self._prep_response(status=404)
          else:
              return self._prep_response({'message': e.message},
                                         status=409)
docs: This exception handler catches should only be invoked when we need
             to quit the workflow prematurely. It takes in an `ApiException`
             which will contain the error, details of the error and  status code.
             When the application is in testing mode, it will also return the
             stack trace