def __init__(self, description, locator="", code=400): self.code = code self.description = description self.locator = locator logging.exception(description) HTTPException.__init__(self)
def __init__(self, data, description=None): """ param: data: A dictionary containing the field errors that occured param: description: Optional description to send through """ HTTPException.__init__(self) self.data = data
def __init__(self, data_request_id): HTTPException.__init__(self) self.code = 404 self.data = dict() self.data[ 'message'] = "There is not an api response associated to the data request with id '{0}'".format( data_request_id)
def __init__(self, code, addr, namespace): self.code = code self.data = { 'message': "fail binding address %s to tenant %s " % (addr, namespace) } HTTPException.__init__(self)
def __init__(self, data, description=None): """ :param: data: A dictionary containing the field errors that occured :param: description: Optional description to send through """ HTTPException.__init__(self) self.description = description self.data = data
def __init__(self, description=None, request=None, user=None): if user is not None and description is None: description = "The requested record is locked by user : {}.".format( user) self.user = user HTTPException.__init__(self, description, request) return
def __init__(self, account_number): HTTPException.__init__(self) self.code = 404 self.data = { 'message': "The Account whit this account_number: {} was not found.".format( account_number) }
def __init__(self, description, locator="", code=400): self.code = code self.description = description self.locator = locator msg = 'Exception: code: %s, locator: %s, description: %s' % (self.code, self.description, self.locator) LOGGER.exception(msg) HTTPException.__init__(self)
def __init__(self, user_name, password): HTTPException.__init__(self) self.code = 404 self.data = { 'message': "The User with user_name: {} and password: {} was not found.". format(user_name, password) }
def __init__(self, user_id, pin): HTTPException.__init__(self) self.code = 404 self.data = { 'message': "The User with user_id: {} and pin: {} was not found.".format( user_id, pin) }
def __init__(self, description, locator="", code=400): self.code = code self.description = description self.locator = locator msg = 'Exception: code: {}, locator: {}, description: {}'.format(self.code, self.description, self.locator) LOGGER.exception(msg) HTTPException.__init__(self)
def __init__(self, user_id, pin): HTTPException.__init__(self) self.code = 401 self.data = { 'message': "The User your trying to process is not validate. [user_id: {} and pin: {}]." .format(user_id, pin) }
def __init__(self, account_number, amount, currency): HTTPException.__init__(self) self.code = 409 self.data = { 'message': "Insufficient funds to perform a {0} {1} withdrawal, account_number {2}." .format(amount, currency, account_number) }
def __init__(self, user_id): HTTPException.__init__(self) self.code = 404 self.data = { 'message': "There is no account associated to this user_id: {} was not found." .format(user_id) }
def __init__(self, description=None, code=None, subdomain=None, query_params=None): if description is None: abort(code) self.subdomain = subdomain self.query_params = query_params if code is not None: self.code = code self.description = description HTTPException.__init__(self, description=self.description)
def __init__(self, user_id, pin, workflow_messages): HTTPException.__init__(self) workflow_messages. \ append("ERROR MESSAGE: The User your trying to process is not validate. [user_id: {} and pin: {}].". format(user_id, pin)) self.code = 401 self.data = { 'message': workflow_messages }
def __init__(self, account_number, amount, currency, workflow_messages): HTTPException.__init__(self) workflow_messages.\ append("ERROR MESSAGE: Insufficient funds to perform a {0} {1} withdrawal, account_number {2}.". format(amount, currency, account_number)) self.code = 409 self.data = { 'message': workflow_messages }
def __init__(self, title=None, description=None, response=None): """ :param title: Title of the problem. :type title: str """ ConnexionException.__init__(self) HTTPException.__init__(self, description, response) self.title = title or self.name
def __init__(self, data=None, msg="", raw_data=None, lan="en"): self.data = data self.lan = lan self.msg = "%s: %s" % (self._ret_cls.INFO( self.result_code, lan), self.msg) self._init_msg(data, msg) self.code = self.status log.error(self.msg) HTTPException.__init__(self, self.msg)
def __init__(message, code=500, data=None, **kwargs): data = data or kwargs response_dict = {"status": "error", "message": message} if code != 500: response_dict["code"] = code if data: response_dict["data"] = data response = jsonify(response_dict) response.status_code = status_code HTTPException.__init__(self, message, response) self.code = code
def __init__(message=None, data=None, code=400, **kwargs): data = data or kwargs if instanceof(message, str): data, message = message, None if message: data["message"] = message response = jsonify(status="fail", data=data) response.status_code = status_code HTTPException.__init__(self, message, response) self.code = code
def __init__(self, description, code): HTTPException.__init__(self) # set defaults self.description = "Something wrong happened" self.code = 400 if description is not None: self.description = description if code is not None: self.code = code
def __init__(self, e): """ param: e: parent exception to wrap and manipulate """ HTTPException.__init__(self) self.data = {"name": self.name} bits = e.message.split("\n") if len(bits) > 1: self.data["error"] = bits[0] self.data["message"] = " ".join(bits[1:]).strip() else: self.data["message"] = " ".join(bits).strip()
def __init__(self, e): """ param: e: parent exception to wrap and manipulate """ HTTPException.__init__(self) self.data = e.data if hasattr(e, "data") else {} self.code = e.code if hasattr(e, "code") else INTEGRITY_ERROR bits = e.message.split("\n") if len(bits) > 1: self.data["error"] = bits[0] self.data["message"] = " ".join(bits[1:]).strip() else: self.data["message"] = " ".join(bits).strip()
def __init__(self, message, survey_id=None, party_id=None, status_code=None): HTTPException.__init__(self) self.description = { 'message': message, 'survey_id': survey_id, 'party_id': party_id } if status_code is not None: self.code = status_code
def __init__(self, status=None, source=None, title="An Error occurred", detail=None, exception=None, trace=None): HTTPException.__init__(self) self.count = 0 self.code = status self.detail = detail self.title = title self.trace = trace self.source = source self.error = {"errors": []} if exception is not None: try: raise exception except DetailedHTTPException as e: self.count = exception.count + 1 if (self.code is None): self.code = e.code for errors in e.error["errors"]: print(errors) self.error["errors"].append(errors) # Incase of general exception. except Exception as e: if self.detail is None: self.detail = {"Error": repr(e)} if self.code is None: self.code = 500 if self.title is None: self.title = repr(e) if self.detail is None: self.detail = "An unspecified Error has occurred" if self.code is None: self.code = 500 uuid = str(guid()) er = { "id": uuid, "status": self.code, "source": self.source, "trace": self.trace, "title": self.title, "detail": self.detail, "count": self.count } self.error["errors"].append(er) self.description = dumps(self.error, indent=3)
def __init__(self, valid_methods=None, description=None): """Takes an optional list of valid http methods starting with werkzeug 0.3 the list will be mandatory.""" HTTPException.__init__(self, description) self.valid_methods = valid_methods
def __init__(self, location): HTTPException.__init__(self) self.location = location
def __init__(self, article_name, original_link, description=None): HTTPException.__init__(self, description) self.article_name = article_name self.original_link = original_link
def __init__(self, message=''): # HTTPException has its own custom __init__ method, but we want the # usual "First argument is the message" behavior. HTTPException.__init__(self) self.message = message
def __init__(self, _server_id, _database_name, _conn_id): self.sid = _server_id self.db = _database_name self.conn_id = _conn_id HTTPException.__init__(self)
def __init__(self, _tunnel_host): self.tunnel_host = _tunnel_host HTTPException.__init__(self)
def __init__(self, msg='', code=1): HTTPException.__init__(self) self.response = jsonify(dict(error_code=code, error_msg=msg))
def __init__(self, code, description): HTTPException.__init__(self) self.code = code self.description = description
def __init__(self, message, code=None): HTTPException.__init__(self, message) if code is not None: self.code = code
def __init__(self, message="Internal Error", response=None): if WERKZEUG: HTTPException.__init__(self, message, response) else: self.description = message self.response = response
def __init__ (self, detail='not Found', status=404): HTTPException.__init__ (self) self.detail = detail self.status = status
def __init__(self): HTTPException.__init__(self)
def __init__(self): HTTPException.__init__(self) self.code = 400 self.data = dict() self.data[ 'message'] = 'The request cannot be fulfilled due to bad syntax.'
def init(self, description=None, response=None, traceback=None): self.traceback = traceback HTTPException.__init__(self, description, response)