More specific error returns

This commit is contained in:
zandercymatics 2023-10-11 14:31:13 -06:00
parent f22d72da4d
commit a02d27aaec
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
2 changed files with 10 additions and 6 deletions

View file

@ -1,6 +1,11 @@
import logging
from geventconnpool import ConnectionPool
from epplibwrapper import RegistryError
from epplibwrapper.errors import LoginError
from epplibwrapper.socket import Socket
logger = logging.getLogger(__name__)
class EppConnectionPool(ConnectionPool):
def __init__(self, client, login, options):
# For storing shared credentials
@ -13,8 +18,10 @@ class EppConnectionPool(ConnectionPool):
try:
connection = socket.connect()
return connection
except Exception as err:
raise err
except LoginError as err:
message = "_new_connection failed to execute due to a registry login error."
logger.warning(message, exc_info=True)
raise RegistryError(message) from err
def _keepalive(self, connection):
pass