You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
751 B
26 lines
751 B
"""
|
|
RPC Specific Exceptions
|
|
"""
|
|
|
|
import requests
|
|
|
|
|
|
class RPCError( RuntimeError ):
|
|
"""Exception raised when RPC call returns an error."""
|
|
def __init__( self, method, endpoint, error ):
|
|
self.error = error
|
|
super().__init__(
|
|
f"Error in reply from {endpoint}: {method} returned {error}"
|
|
)
|
|
|
|
|
|
class RequestsError( requests.exceptions.RequestException ):
|
|
"""Wrapper for requests lib exceptions."""
|
|
def __init__( self, endpoint ):
|
|
super().__init__( f"Error connecting to {endpoint}" )
|
|
|
|
|
|
class RequestsTimeoutError( requests.exceptions.Timeout ):
|
|
"""Wrapper for requests lib Timeout exceptions."""
|
|
def __init__( self, endpoint ):
|
|
super().__init__( f"Error connecting to {endpoint}" )
|
|
|