@@ -100,7 +100,7 @@ def __init__(self, database: AsyncDatabase, collection: str = "fs"):
100
100
.. seealso:: The MongoDB documentation on `gridfs <https://dochub.mongodb.org/core/gridfs>`_.
101
101
"""
102
102
if not isinstance (database , AsyncDatabase ):
103
- raise TypeError ("database must be an instance of Database" )
103
+ raise TypeError (f "database must be an instance of Database, not { type ( database ) } " )
104
104
105
105
database = _clear_entity_type_registry (database )
106
106
@@ -503,7 +503,7 @@ def __init__(
503
503
.. seealso:: The MongoDB documentation on `gridfs <https://dochub.mongodb.org/core/gridfs>`_.
504
504
"""
505
505
if not isinstance (db , AsyncDatabase ):
506
- raise TypeError ("database must be an instance of AsyncDatabase" )
506
+ raise TypeError (f "database must be an instance of AsyncDatabase, not { type ( db ) } " )
507
507
508
508
db = _clear_entity_type_registry (db )
509
509
@@ -1082,7 +1082,9 @@ def __init__(
1082
1082
:attr:`~pymongo.collection.AsyncCollection.write_concern`
1083
1083
"""
1084
1084
if not isinstance (root_collection , AsyncCollection ):
1085
- raise TypeError ("root_collection must be an instance of AsyncCollection" )
1085
+ raise TypeError (
1086
+ f"root_collection must be an instance of AsyncCollection, not { type (root_collection )} "
1087
+ )
1086
1088
1087
1089
if not root_collection .write_concern .acknowledged :
1088
1090
raise ConfigurationError ("root_collection must use acknowledged write_concern" )
@@ -1436,7 +1438,9 @@ def __init__(
1436
1438
from the server. Metadata is fetched when first needed.
1437
1439
"""
1438
1440
if not isinstance (root_collection , AsyncCollection ):
1439
- raise TypeError ("root_collection must be an instance of AsyncCollection" )
1441
+ raise TypeError (
1442
+ f"root_collection must be an instance of AsyncCollection, not { type (root_collection )} "
1443
+ )
1440
1444
_disallow_transactions (session )
1441
1445
1442
1446
root_collection = _clear_entity_type_registry (root_collection )
0 commit comments