Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change exception type #527

Merged
merged 3 commits into from
Dec 30, 2024
Merged

Conversation

ChenZiHong-Gavin
Copy link
Contributor

we should use APITimeoutError instead of Timeout in retry_if_exception_type because Timeout is not a a kind of BaseException. But retry_if_exception_type needs the input type to be BaseException.

class retry_if_exception_type(retry_if_exception):
    """Retries if an exception has been raised of one or more types."""

    def __init__(
        self,
        exception_types: typing.Union[
            typing.Type[BaseException],
            typing.Tuple[typing.Type[BaseException], ...],
        ] = Exception,
    ) -> None:
        self.exception_types = exception_types
        super().__init__(lambda e: isinstance(e, exception_types))

@LarFii
Copy link
Collaborator

LarFii commented Dec 30, 2024

Thanks! But there are some linting errors. Please make sure to run pre-commit run --all-files before submitting to ensure all linting checks pass.

@ChenZiHong-Gavin
Copy link
Contributor Author

Thanks! But there are some linting errors. Please make sure to run pre-commit run --all-files before submitting to ensure all linting checks pass.

Sure. I've fixed the linting errors.

@LarFii LarFii merged commit c0eef70 into HKUDS:main Dec 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants