-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexceptions.py
More file actions
19 lines (16 loc) · 828 Bytes
/
Copy pathexceptions.py
File metadata and controls
19 lines (16 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Sessy exceptions"""
class RequestError(Exception):
"""Custom error to handle return errors from API calls"""
def __init__(self, code, error_message):
self.message = "Failed call to Sessy API (status code = {}, error message: '{}')".format(code, error_message)
super().__init__(self.message)
class ScheduleError(Exception):
"""Custom error to handle return errors from API calls"""
def __init__(self, data_element, date_string):
self.message = "Missing schedule information '{}' for {}".format(data_element, date_string)
super().__init__(self.message)
class TooManyRetries(Exception):
"""Too many retries to call API"""
def __init__(self):
self.message = "Failed to call Sessy API (too many retries)"
super().__init__(self.message)