mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
add more exceptions to catch
This commit is contained in:
parent
d124c69d46
commit
f74f062b34
1 changed files with 3 additions and 4 deletions
|
|
@ -17,7 +17,8 @@ from pymongo import MongoClient
|
|||
from pymongo.errors import (
|
||||
ServerSelectionTimeoutError,
|
||||
InvalidURI,
|
||||
ConfigurationError
|
||||
ConfigurationError,
|
||||
OperationFailure
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -131,9 +132,7 @@ def validate_mongo_connection(cnx: str) -> (bool, str):
|
|||
return False, f"Cannot connect to server {cnx} - {e}"
|
||||
except ValueError:
|
||||
return False, f"Invalid port specified {parsed.port}"
|
||||
except InvalidURI as e:
|
||||
return False, str(e)
|
||||
except ConfigurationError as exc:
|
||||
except (ConfigurationError, OperationFailure, InvalidURI) as exc:
|
||||
return False, str(exc)
|
||||
else:
|
||||
return True, "Connection is successful"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue