Exemplo n.º 1
0
    def __init__(self, description, locator="", code=400):
        self.code = code
        self.description = description
        self.locator = locator
        logging.exception(description)

        HTTPException.__init__(self)
Exemplo n.º 2
0
	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
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 def __init__(self, code, addr, namespace):
     self.code = code
     self.data = {
         'message':
         "fail binding address %s to tenant %s " % (addr, namespace)
     }
     HTTPException.__init__(self)
Exemplo n.º 5
0
    def __init__(self, description, locator="", code=400):
        self.code = code
        self.description = description
        self.locator = locator
        logging.exception(description)

        HTTPException.__init__(self)
Exemplo n.º 6
0
 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
Exemplo n.º 7
0
    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
Exemplo n.º 8
0
 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)
     }
Exemplo n.º 9
0
    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)
Exemplo n.º 10
0
 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)
     }
Exemplo n.º 11
0
 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)
     }
Exemplo n.º 12
0
    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)
Exemplo n.º 13
0
 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)
     }
Exemplo n.º 14
0
 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)
     }
Exemplo n.º 15
0
 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)
     }
Exemplo n.º 16
0
 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)
Exemplo n.º 17
0
 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
     }
Exemplo n.º 18
0
 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
     }
Exemplo n.º 19
0
    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
Exemplo n.º 20
0
    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)
Exemplo n.º 21
0
 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
Exemplo n.º 22
0
    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
Exemplo n.º 23
0
    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
Exemplo n.º 24
0
	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()
Exemplo n.º 25
0
 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()
Exemplo n.º 26
0
 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
Exemplo n.º 27
0
    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)
Exemplo n.º 28
0
 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
Exemplo n.º 29
0
 def __init__(self, location):
     HTTPException.__init__(self)
     self.location = location
Exemplo n.º 30
0
 def __init__(self, article_name, original_link, description=None):
     HTTPException.__init__(self, description)
     self.article_name = article_name
     self.original_link = original_link
Exemplo n.º 31
0
 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
Exemplo n.º 32
0
 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)
Exemplo n.º 33
0
 def __init__(self, _tunnel_host):
     self.tunnel_host = _tunnel_host
     HTTPException.__init__(self)
Exemplo n.º 34
0
 def __init__(self, msg='', code=1):
     HTTPException.__init__(self)
     self.response = jsonify(dict(error_code=code, error_msg=msg))
Exemplo n.º 35
0
 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)
Exemplo n.º 36
0
 def __init__(self, code, description):
     HTTPException.__init__(self)
     self.code = code
     self.description = description
Exemplo n.º 37
0
Arquivo: rest.py Projeto: coyotevz/nbs
 def __init__(self, message, code=None):
     HTTPException.__init__(self, message)
     if code is not None:
         self.code = code
Exemplo n.º 38
0
 def __init__(self, message="Internal Error", response=None):
     if WERKZEUG:
         HTTPException.__init__(self, message, response)
     else:
         self.description = message
         self.response = response
Exemplo n.º 39
0
 def __init__(self, article_name, original_link, description=None):
     HTTPException.__init__(self, description)
     self.article_name = article_name
     self.original_link = original_link
Exemplo n.º 40
0
 def __init__ (self, detail='not Found', status=404):
     HTTPException.__init__ (self)
     self.detail = detail
     self.status = status
Exemplo n.º 41
0
 def __init__(self):
     HTTPException.__init__(self)
Exemplo n.º 42
0
 def __init__(self, _tunnel_host):
     self.tunnel_host = _tunnel_host
     HTTPException.__init__(self)
Exemplo n.º 43
0
 def __init__(self):
     HTTPException.__init__(self)
     self.code = 400
     self.data = dict()
     self.data[
         'message'] = 'The request cannot be fulfilled due to bad syntax.'
Exemplo n.º 44
0
 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
Exemplo n.º 45
0
 def __init__(self, code, description):
     HTTPException.__init__(self)
     self.code = code
     self.description = description
Exemplo n.º 46
0
def init(self, description=None, response=None, traceback=None):
    self.traceback = traceback
    HTTPException.__init__(self, description, response)