-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: error segregation into errors.py
- Loading branch information
1 parent
04065b8
commit 33ee61a
Showing
3 changed files
with
51 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
RealValidation API Reference | ||
============================ | ||
.. automodule:: realvalidation.realvalidation | ||
|
||
Application Object | ||
------------------ | ||
|
||
.. autoclass:: realvalidation.RealValidation | ||
:members: | ||
|
||
Errors | ||
------ | ||
.. automodule:: realvalidation.errors | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
|
||
class RealValidationError(Exception): | ||
"""Base class for exceptions in this module.""" | ||
pass | ||
|
||
class InvalidTokenError(RealValidationError): | ||
"""Raised when a token couldn't be enumerated. Tokens can passed as a | ||
parameter when initializing a ``RealValidation`` object or by setting the | ||
``RV_TOKEN`` environmental variable before execution. | ||
""" | ||
pass | ||
|
||
class InvalidPhoneFormatError(RealValidationError): | ||
"""Raised when a phone string doesn't match ``PHONE_REGEX``""" | ||
pass | ||
|
||
|
||
class InvalidJSONResponseError(RealValidationError): | ||
"""Raised when we couldn't decode a JSON response from a RealValidation | ||
API Request | ||
""" | ||
pass | ||
|
||
|
||
class ResponseCodeNotOkError(RealValidationError): | ||
"""Raised when ``RESPONSECODE`` in a RealValidation JSON response does not | ||
equal ``OK`` | ||
""" | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters