mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
be explicit in exception
This commit is contained in:
parent
707c2b0293
commit
19937467f4
1 changed files with 6 additions and 2 deletions
|
|
@ -14,7 +14,11 @@ from pathlib import Path
|
|||
import platform
|
||||
|
||||
from pymongo import MongoClient
|
||||
from pymongo.errors import ServerSelectionTimeoutError, InvalidURI
|
||||
from pymongo.errors import (
|
||||
ServerSelectionTimeoutError,
|
||||
InvalidURI,
|
||||
ConfigurationError
|
||||
)
|
||||
|
||||
|
||||
def decompose_url(url: str) -> Dict:
|
||||
|
|
@ -139,7 +143,7 @@ def validate_mongo_connection(cnx: str) -> (bool, str):
|
|||
return False, f"Invalid port specified {parsed.port}"
|
||||
except InvalidURI as e:
|
||||
return False, str(e)
|
||||
except Exception as exc:
|
||||
except ConfigurationError as exc:
|
||||
return False, str(exc)
|
||||
else:
|
||||
return True, "Connection is successful"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue