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

Expose Exception Attributes on SolanaRpcException #378

Closed
wants to merge 1 commit into from

Conversation

datasalaryman
Copy link

The current implementation of SolanaRpcException only takes in the Exception exc but does not expose it to the user. They cannot access its attributes and diagnose further when there are problems.

Sending this as a draft pull request until I figure out how this works properly.

class SolanaRpcException(SolanaExceptionBase):
    """Class for Solana-py RPC exceptions."""

    @staticmethod
    def _build_error_message(
        exc: Exception,
        func: Callable[[Any], Any],  # noqa: ARG004
        *args: Any,
        **kwargs: Any,  # noqa: ARG004
    ) -> str:
        rpc_method = args[1].__class__.__name__
        return f'{type(exc)} raised in "{rpc_method}" endpoint request'

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.

1 participant