Skip to content

Commit 4fd3790

Browse files
committed
PHPLIB-234: Document exceptions for API methods
1 parent 3cc5732 commit 4fd3790

File tree

69 files changed

+473
-37
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+473
-37
lines changed

docs/includes/extracts-error.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
ref: error-driver-invalidargumentexception
2+
content: |
3+
:php:`MongoDB\\Driver\\Exception\\InvalidArgumentException
4+
<mongodb-driver-exception-invalidargumentexception>` for errors related to the
5+
parsing of parameters or options at the driver level.
6+
---
7+
ref: error-driver-runtimeexception
8+
content: |
9+
:php:`MongoDB\\Driver\\Exception\\RuntimeException
10+
<mongodb-driver-exception-runtimeexception>` for other errors at the driver
11+
level (e.g. connection errors).
12+
---
13+
ref: error-invalidargumentexception
14+
content: |
15+
:phpclass:`MongoDB\\Exception\\InvalidArgumentException` for errors related to
16+
the parsing of parameters or options.
17+
---
18+
ref: error-unexpectedvalueexception
19+
content: |
20+
:phpclass:`MongoDB\\Exception\\UnexpectedValueException` if the command
21+
response from the server was malformed.
22+
---
23+
ref: error-unsupportedexception
24+
content: |
25+
:phpclass:`MongoDB\\Exception\\UnsupportedException` if options are used and
26+
not supported by the selected server (e.g. ``collation``, ``writeConcern``).
27+
...

docs/reference/method/MongoDBClient-dropDatabase.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ An array or object with the result document of the :manual:`dropDatabase
3636
</reference/command/dropDatabase>` command. The return type will depend on the
3737
``typeMap`` option.
3838

39+
Errors/Exceptions
40+
-----------------
41+
42+
.. include:: /includes/extracts/error-unsupportedexception.rst
43+
.. include:: /includes/extracts/error-invalidargumentexception.rst
44+
.. include:: /includes/extracts/error-driver-runtimeexception.rst
45+
3946
Example
4047
-------
4148

docs/reference/method/MongoDBClient-listDatabases.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ A traversable :phpclass:`MongoDB\\Model\\DatabaseInfoIterator`, which contains
3636
a :phpclass:`MongoDB\\Model\\DatabaseInfo` object for each database on the
3737
server.
3838

39+
Errors/Exceptions
40+
-----------------
41+
42+
.. include:: /includes/extracts/error-unexpectedvalueexception.rst
43+
.. include:: /includes/extracts/error-invalidargumentexception.rst
44+
.. include:: /includes/extracts/error-driver-runtimeexception.rst
45+
3946
Example
4047
-------
4148

docs/reference/method/MongoDBClient-selectCollection.txt

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

3535
A :phpclass:`MongoDB\\Collection` object.
3636

37+
Errors/Exceptions
38+
-----------------
39+
40+
.. include:: /includes/extracts/error-invalidargumentexception.rst
41+
3742
Behavior
3843
--------
3944

docs/reference/method/MongoDBClient-selectDatabase.txt

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

3535
A :phpclass:`MongoDB\\Database` object.
3636

37+
Errors/Exceptions
38+
-----------------
39+
40+
.. include:: /includes/extracts/error-invalidargumentexception.rst
41+
3742
Behavior
3843
--------
3944

docs/reference/method/MongoDBClient__construct.txt

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

3030
.. include:: /includes/apiargs/MongoDBClient-method-construct-driverOptions.rst
3131

32+
Errors/Exceptions
33+
-----------------
34+
35+
.. include:: /includes/extracts/error-invalidargumentexception.rst
36+
.. include:: /includes/extracts/error-driver-invalidargumentexception.rst
37+
.. include:: /includes/extracts/error-driver-runtimeexception.rst
38+
3239
Examples
3340
--------
3441

docs/reference/method/MongoDBCollection-aggregate.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ A :php:`MongoDB\\Driver\\Cursor <class.mongodb-driver-cursor>` or
3737
:php:`ArrayIterator <arrayiterator>` object. In both cases, the return value
3838
will be :php:`Traversable <traversable>`.
3939

40+
Errors/Exceptions
41+
-----------------
42+
43+
.. include:: /includes/extracts/error-unexpectedvalueexception.rst
44+
.. include:: /includes/extracts/error-unsupportedexception.rst
45+
.. include:: /includes/extracts/error-invalidargumentexception.rst
46+
.. include:: /includes/extracts/error-driver-runtimeexception.rst
47+
4048
.. _php-agg-method-behavior:
4149

4250
Behavior

docs/reference/method/MongoDBCollection-bulkWrite.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ Return Values
3535
A :phpclass:`MongoDB\\BulkWriteResult` object, which encapsulates a
3636
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
3737

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

4047
See Also

docs/reference/method/MongoDBCollection-count.txt

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

3535
The number of documents matching the filter criteria.
3636

37+
Errors/Exceptions
38+
-----------------
39+
40+
.. include:: /includes/extracts/error-unexpectedvalueexception.rst
41+
.. include:: /includes/extracts/error-unsupportedexception.rst
42+
.. include:: /includes/extracts/error-invalidargumentexception.rst
43+
.. include:: /includes/extracts/error-driver-runtimeexception.rst
44+
3745
.. todo: add output and examples
3846

3947
See Also

docs/reference/method/MongoDBCollection-createIndex.txt

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

4040
The name of the created index as a string.
4141

42+
Errors/Exceptions
43+
-----------------
44+
45+
.. include:: /includes/extracts/error-unsupportedexception.rst
46+
.. include:: /includes/extracts/error-invalidargumentexception.rst
47+
.. include:: /includes/extracts/error-driver-runtimeexception.rst
48+
4249
Examples
4350
--------
4451

0 commit comments

Comments
 (0)