-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: review integrations sagemaker (#544)
* refactor: remove reimplementing exceptions * docs: review docs * style: reformat * style: shorten line
- Loading branch information
Showing
2 changed files
with
19 additions
and
48 deletions.
There are no files selected for viewing
32 changes: 1 addition & 31 deletions
32
...azon_sagemaker/src/haystack_integrations/components/generators/amazon_sagemaker/errors.py
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,46 +1,16 @@ | ||
from typing import Optional | ||
|
||
|
||
class SagemakerError(Exception): | ||
""" | ||
Error generated by the Amazon Sagemaker integration. | ||
Parent class for all exceptions raised by the Sagemaker component | ||
""" | ||
|
||
def __init__( | ||
self, | ||
message: Optional[str] = None, | ||
): | ||
super().__init__() | ||
if message: | ||
self.message = message | ||
|
||
def __getattr__(self, attr): | ||
# If self.__cause__ is None, it will raise the expected AttributeError | ||
getattr(self.__cause__, attr) | ||
|
||
def __str__(self): | ||
return self.message | ||
|
||
def __repr__(self): | ||
return str(self) | ||
|
||
|
||
class AWSConfigurationError(SagemakerError): | ||
"""Exception raised when AWS is not configured correctly""" | ||
|
||
def __init__(self, message: Optional[str] = None): | ||
super().__init__(message=message) | ||
|
||
|
||
class SagemakerNotReadyError(SagemakerError): | ||
"""Exception for issues that occur during Sagemaker inference""" | ||
|
||
def __init__(self, message: Optional[str] = None): | ||
super().__init__(message=message) | ||
|
||
|
||
class SagemakerInferenceError(SagemakerError): | ||
"""Exception for issues that occur during Sagemaker inference""" | ||
|
||
def __init__(self, message: Optional[str] = None): | ||
super().__init__(message=message) |
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