File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change 4444 )
4545 )
4646 log .info ("Loaded ISPyB database session" )
47- except AttributeError :
47+ # Catch all errors associated with loading ISPyB database
48+ except Exception :
4849 log .error ("Error loading ISPyB session" , exc_info = True )
4950 ISPyBSession = lambda : None
5051
@@ -66,13 +67,17 @@ def __init__(self, transport_type: Literal["PikaTransport"]):
6667 self .transport = workflows .transport .lookup (transport_type )()
6768 self .transport .connect ()
6869 self .feedback_queue = ""
69- self .ispyb = (
70- ispyb .open (credentials = security_config .ispyb_credentials )
71- if security_config .ispyb_credentials
72- else None
73- )
74- if self .ispyb is not None :
75- print ("Loaded ISPyB databse" )
70+ try :
71+ # Attempt to connect to ISPyB if credentials files provided
72+ self .ispyb = (
73+ ispyb .open (credentials = security_config .ispyb_credentials )
74+ if security_config .ispyb_credentials
75+ else None
76+ )
77+ except Exception :
78+ # Log error and return None if the connection fails
79+ log .error ("Error encountered connecting to ISPyB server" , exc_info = True )
80+ self .ispyb = None
7681 self ._connection_callback : Callable | None = None
7782
7883 def reconnect (self ):
You can’t perform that action at this time.
0 commit comments