]> kaliko git repositories - python-musicpd.git/blobdiff - doc/source/examples.rst
Improved exceptions doc, fixed sphinx warnings
[python-musicpd.git] / doc / source / examples.rst
index 291344cd104298fb40d6b17dc80111ab4fbbff10..cf4c916d253a89f98fd2a59c0a4f5232b09aafa1 100644 (file)
@@ -42,3 +42,16 @@ A plain client monitoring changes on MPD.
    :language: python
    :linenos:
 
+.. _exceptions_example:
+
+Dealing with Exceptions
+-----------------------
+
+Musicpd module will raise it's own :py:obj:`MPDError<musicpd.MPDError>`
+exceptions **and** python :py:obj:`OSError`. Then you can wrap
+:py:obj:`OSError` in :py:obj:`MPDError<musicpd.MPDError>` exceptions to have to deal
+with a single type of exceptions in your code:
+
+.. literalinclude:: examples/exceptions.py
+   :language: python
+   :linenos: