X-Git-Url: https://git.kaliko.me/?p=python-musicpd.git;a=blobdiff_plain;f=doc%2Fsource%2Fexamples.rst;fp=doc%2Fsource%2Fexamples.rst;h=cf4c916d253a89f98fd2a59c0a4f5232b09aafa1;hp=291344cd104298fb40d6b17dc80111ab4fbbff10;hb=9aa136ff3dc89f1f9a396f8404eb4c8064fa891c;hpb=2399137b973746fdc4286856e1d78c22c7fcaff1 diff --git a/doc/source/examples.rst b/doc/source/examples.rst index 291344c..cf4c916 100644 --- a/doc/source/examples.rst +++ b/doc/source/examples.rst @@ -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` +exceptions **and** python :py:obj:`OSError`. Then you can wrap +:py:obj:`OSError` in :py:obj:`MPDError` exceptions to have to deal +with a single type of exceptions in your code: + +.. literalinclude:: examples/exceptions.py + :language: python + :linenos: