@@ -100,7 +100,7 @@ def __init__(self, database: AsyncDatabase, collection: str = "fs"):
100100 .. seealso:: The MongoDB documentation on `gridfs <https://dochub.mongodb.org/core/gridfs>`_.
101101 """
102102 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 ) } " )
104104
105105 database = _clear_entity_type_registry (database )
106106
@@ -503,7 +503,7 @@ def __init__(
503503 .. seealso:: The MongoDB documentation on `gridfs <https://dochub.mongodb.org/core/gridfs>`_.
504504 """
505505 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 ) } " )
507507
508508 db = _clear_entity_type_registry (db )
509509
@@ -1082,7 +1082,9 @@ def __init__(
10821082 :attr:`~pymongo.collection.AsyncCollection.write_concern`
10831083 """
10841084 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+ )
10861088
10871089 if not root_collection .write_concern .acknowledged :
10881090 raise ConfigurationError ("root_collection must use acknowledged write_concern" )
@@ -1436,7 +1438,9 @@ def __init__(
14361438 from the server. Metadata is fetched when first needed.
14371439 """
14381440 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+ )
14401444 _disallow_transactions (session )
14411445
14421446 root_collection = _clear_entity_type_registry (root_collection )
0 commit comments