Skip to content

Commit d259a5f

Browse files
committed
Merge pull request #296
2 parents 34ae987 + 470fcca commit d259a5f

18 files changed

+154
-27
lines changed

docs/includes/extracts-error.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,14 @@ content: |
3131
:phpclass:`MongoDB\\Exception\\UnsupportedException` if options are used and
3232
not supported by the selected server (e.g. ``collation``, ``readConcern``,
3333
``writeConcern``).
34+
---
35+
ref: error-gridfs-filenotfoundexception
36+
content: |
37+
:phpclass:`MongoDB\\GridFS\\Exception\\FileNotFoundException` if no file was
38+
found for the selection criteria.
39+
---
40+
ref: error-gridfs-corruptfileexception
41+
content: |
42+
:phpclass:`MongoDB\\GridFS\\Exception\\CorruptFileException` if the file's
43+
metadata or chunk documents contain unexpected or invalid data.
3444
...

docs/reference/exception-classes.txt

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ MongoDB\\Exception\\UnsupportedException
7777
unintended document being deleted.
7878

7979
This class extends the library's :phpclass:`RuntimeException
80-
<MongoDB\\Exception\\RuntimeException>` class and implements the
81-
library's :phpclass:`Exception <MongoDB\\Exception\\Exception>` interface.
80+
<MongoDB\\Exception\\RuntimeException>` class.
8281

8382
.. note::
8483

@@ -89,6 +88,37 @@ MongoDB\\Exception\\UnsupportedException
8988

9089
----
9190

91+
MongoDB\\GridFS\\Exception\\CorruptFileException
92+
----------------------------------------
93+
94+
.. phpclass:: MongoDB\\GridFS\\Exception\\CorruptFileException
95+
96+
This exception is thrown if a GridFS file's metadata or chunk documents
97+
contain unexpected or invalid data.
98+
99+
When selecting a GridFS file, this may be thrown if a metadata field has an
100+
incorrect type or its value is out of range (e.g. negative ``length``). When
101+
reading a GridFS file, this may be thrown if a chunk's index is out of
102+
sequence or its binary data's length out of range.
103+
104+
This class extends the library's :phpclass:`RuntimeException
105+
<MongoDB\\Exception\\RuntimeException>` class.
106+
107+
----
108+
109+
MongoDB\\GridFS\\Exception\\FileNotFoundException
110+
----------------------------------------
111+
112+
.. phpclass:: MongoDB\\GridFS\\Exception\\FileNotFoundException
113+
114+
This exception is thrown if no GridFS file was found for the selection
115+
criteria (e.g. ``id``, ``filename``).
116+
117+
This class extends the library's :phpclass:`RuntimeException
118+
<MongoDB\\Exception\\RuntimeException>` class.
119+
120+
----
121+
92122
MongoDB\\Exception\\Exception
93123
-----------------------------
94124

docs/reference/method/MongoDBGridFSBucket-delete.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ Definition
2525

2626
.. include:: /includes/apiargs/MongoDBGridFSBucket-method-delete-param.rst
2727

28+
Errors/Exceptions
29+
-----------------
30+
31+
.. include:: /includes/extracts/error-gridfs-filenotfoundexception.rst
32+
.. include:: /includes/extracts/error-driver-runtimeexception.rst
33+
2834
Behavior
2935
--------
3036

docs/reference/method/MongoDBGridFSBucket-downloadToStream.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ Definition
2828

2929
.. todo: add examples
3030

31+
Errors/Exceptions
32+
-----------------
33+
34+
.. include:: /includes/extracts/error-gridfs-filenotfoundexception.rst
35+
.. include:: /includes/extracts/error-invalidargumentexception.rst
36+
.. include:: /includes/extracts/error-driver-runtimeexception.rst
37+
3138
See Also
3239
--------
3340

docs/reference/method/MongoDBGridFSBucket-downloadToStreamByName.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ Definition
3232

3333
.. todo: add examples
3434

35+
Errors/Exceptions
36+
-----------------
37+
38+
.. include:: /includes/extracts/error-gridfs-filenotfoundexception.rst
39+
.. include:: /includes/extracts/error-invalidargumentexception.rst
40+
.. include:: /includes/extracts/error-driver-runtimeexception.rst
41+
3542
See Also
3643
--------
3744

docs/reference/method/MongoDBGridFSBucket-drop.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@ Definition
2121

2222
function drop(): void
2323

24+
Errors/Exceptions
25+
-----------------
26+
27+
.. include:: /includes/extracts/error-driver-runtimeexception.rst
28+
2429
.. todo: add examples

docs/reference/method/MongoDBGridFSBucket-find.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ Return Values
3434

3535
A :php:`MongoDB\\Driver\\Cursor <class.mongodb-driver-cursor>` object.
3636

37+
Errors/Exceptions
38+
-----------------
39+
40+
.. include:: /includes/extracts/error-unsupportedexception.rst
41+
.. include:: /includes/extracts/error-invalidargumentexception.rst
42+
.. include:: /includes/extracts/error-driver-runtimeexception.rst
43+
3744
.. todo: add examples
3845

3946
See Also

docs/reference/method/MongoDBGridFSBucket-findOne.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ An array or object for the :term:`first document <natural order>` that matched
3737
the query, or ``null`` if no document matched the query. The return type will
3838
depend on the ``typeMap`` option.
3939

40+
Errors/Exceptions
41+
-----------------
42+
43+
.. include:: /includes/extracts/error-unsupportedexception.rst
44+
.. include:: /includes/extracts/error-invalidargumentexception.rst
45+
.. include:: /includes/extracts/error-driver-runtimeexception.rst
46+
4047
.. todo: add examples
4148

4249
See Also

docs/reference/method/MongoDBGridFSBucket-getFileDocumentForStream.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ Return Values
3131
The metadata document associated with the GridFS stream. The return type will
3232
depend on the bucket's ``typeMap`` option.
3333

34+
Errors/Exceptions
35+
-----------------
36+
37+
.. include:: /includes/extracts/error-invalidargumentexception.rst
38+
.. include:: /includes/extracts/error-driver-runtimeexception.rst
39+
3440
.. todo: add examples
3541

3642
See Also

docs/reference/method/MongoDBGridFSBucket-getFileIdForStream.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ Return Values
3131
The ``_id`` field of the metadata document associated with the GridFS stream.
3232
The return type will depend on the bucket's ``typeMap`` option.
3333

34+
Errors/Exceptions
35+
-----------------
36+
37+
.. include:: /includes/extracts/error-gridfs-corruptfileexception.rst
38+
.. include:: /includes/extracts/error-invalidargumentexception.rst
39+
.. include:: /includes/extracts/error-driver-runtimeexception.rst
40+
3441
.. todo: add examples
3542

3643
See Also

0 commit comments

Comments
 (0)