You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
822 B
28 lines
822 B
# Copyright (C) 2005-2024 Splunk Inc. All Rights Reserved.
|
|
|
|
|
|
class UserAccessError(Exception):
|
|
'''
|
|
Set the status and msg on the response
|
|
Ex: raise UserAccessError(status=500, message="Bad User name")
|
|
'''
|
|
|
|
def __init__(self, status=500, message=None):
|
|
self.status = status = int(status)
|
|
if status < 400 or status > 599:
|
|
raise ValueError("status must be between 400 and 599.")
|
|
# See http://www.python.org/dev/peps/pep-0352/
|
|
# self.message = message
|
|
self._message = message
|
|
Exception.__init__(self, status, message)
|
|
|
|
def __call__(self):
|
|
raise self
|
|
|
|
# Following classes have been defined to help us filter out the different exception types...
|
|
class BadRequest(Exception):
|
|
'''
|
|
class to indicate a bad request
|
|
'''
|
|
pass
|