Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Commit

Permalink
Add exceptions module.
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanChappel committed Jul 29, 2019
1 parent eb62210 commit 666d357
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""This module holds exceptions to be used with Alpyca."""


class NumericError(Exception):
"""Exception for when Alpaca throws an error with a numeric value.
Args:
ErrorNumber (int): Non-zero integer.
ErrorMessage (str): Message describing the issue that was encountered.
"""

def __init__(self, ErrorNumber: int, ErrorMessage: str):
"""Initialize NumericError object."""
super().__init__(self)
self.message = "Error %d: %s" % (ErrorNumber, ErrorMessage)

def __str__(self):
"""Message to display with error."""
return self.message


class ErrorMessage(Exception):
"""Exception for when Alpaca throws an error without a numeric value.
Args:
Value (str): Message describing the issue that was encountered.
"""

def __init__(self, Value: str):
"""Initialize ErrorMessage object."""
super().__init__(self)
self.message = Value

def __str__(self):
"""Message to display with error."""
return self.message

0 comments on commit 666d357

Please sign in to comment.