-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start defining custom errors in one place (#2122)
* Moved InferenceTimeoutError * Moved text generation errors --------- Co-authored-by: Lucain <lucainp@gmail.com>
- Loading branch information
Showing
5 changed files
with
49 additions
and
33 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"""Contains all custom errors.""" | ||
|
||
from requests import HTTPError | ||
|
||
|
||
# INFERENCE CLIENT ERRORS | ||
|
||
|
||
class InferenceTimeoutError(HTTPError, TimeoutError): | ||
"""Error raised when a model is unavailable or the request times out.""" | ||
|
||
|
||
# TEXT GENERATION ERRORS | ||
|
||
|
||
class TextGenerationError(HTTPError): | ||
"""Generic error raised if text-generation went wrong.""" | ||
|
||
|
||
# Text Generation Inference Errors | ||
class ValidationError(TextGenerationError): | ||
"""Server-side validation error.""" | ||
|
||
|
||
class GenerationError(TextGenerationError): | ||
pass | ||
|
||
|
||
class OverloadedError(TextGenerationError): | ||
pass | ||
|
||
|
||
class IncompleteGenerationError(TextGenerationError): | ||
pass | ||
|
||
|
||
class UnknownError(TextGenerationError): | ||
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
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
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
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