Skip to content

Commit

Permalink
Add SmartHomeError exception
Browse files Browse the repository at this point in the history
  • Loading branch information
DewGew authored Dec 15, 2023
1 parent 9cd70bd commit 66091c5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions modules/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,16 @@ def generateCsrfToken():

def generate_API_key():
return random_string(16)

class SmartHomeError(Exception):
def __init__(self, code, msg):
"""Log error code."""
super().__init__(msg)
self.code = code

class SmartHomeErrorNoChallenge(Exception):
def __init__(self, code, desc, msg):
"""Log error code."""
super().__init__(msg)
self.code = code
self.desc = desc

0 comments on commit 66091c5

Please sign in to comment.