# -*- coding: utf-8 -*-

"""Exceptions that are used by SoCo."""

from __future__ import unicode_literals


class SoCoException(Exception):

    """base exception raised by SoCo, containing the UPnP error code."""


class UnknownSoCoException(SoCoException):

    """raised if reason of the error can not be extracted.

    The exception object will contain the raw response sent back from
    the speaker
    """


class SoCoUPnPException(SoCoException):

    """encapsulates UPnP Fault Codes raised in response to actions sent over
    the network."""

    def __init__(self, message, error_code, error_xml, error_description=""):
        super(SoCoUPnPException, self).__init__()
        self.message = message
        self.error_code = error_code
        self.error_description = error_description
        self.error_xml = error_xml

    def __str__(self):
        return self.message


class CannotCreateDIDLMetadata(SoCoException):

    """ Deprecated in v.0.11 and will be removed in a future version.

    Use DIDLMetadataError instead.
    """


class DIDLMetadataError(CannotCreateDIDLMetadata):

    """Raised if a data container class cannot create the DIDL metadata due to
    missing information.

    For backward compatibility, this is currently a subclass of
    CannotCreateDIDLMetadata. In a future version, it will likely become
    a direct subclass of SoCoException.
    """


class MusicServiceException(SoCoException):

    """An error relating to a third party music service."""


class UnknownXMLStructure(SoCoException):

    """Raised if XML with and unknown or unexpected structure is returned."""


class SoCoSlaveException(SoCoException):
    """Raised when a master command is called on a slave."""

@@ -145,69 +145,42 @@
  %22%22%22
-b
+B
 ase 
-exception raised by SoCo, containing the UPnP error code
+class for all SoCo exceptions
 .%22%22%22
@@ -237,58 +237,29 @@
  %22%22%22
-raised if reason of the error can not be extracted
+An unknown UPnP error
 .%0A%0A 
@@ -342,16 +342,42 @@
  speaker
+ as the first of its args.
 %0A    %22%22%22
@@ -431,20 +431,9 @@
  %22%22%22
-encapsulates
+A
  UPn
@@ -444,17 +444,17 @@
 ult Code
-s
+,
  raised 
@@ -485,24 +485,24 @@
 ent over
-%0A   
  the
+%0A   
  network
@@ -502,16 +502,22 @@
 network.
+%0A%0A    
 %22%22%22%0A%0A   
@@ -591,16 +591,354 @@
 on=%22%22):%0A
+        %22%22%22%0A        Args:%0A            message (str): The message from the server.%0A            error_code (str): The UPnP Error Code as a string.%0A            error_xml (str): The xml containing the error, as a utf-8%0A                encoded string.%0A            error_description (str): A description of the error. Default is %22%22%0A        %22%22%22%0A
         
@@ -1246,80 +1246,47 @@
  %22%22%22
- Deprecated in v.0.11 and will be removed in a future version.%0A%0A
+%0A    ..  deprecated:: 0.11%0A    
     Use 
 DIDL
@@ -1281,16 +1281,17 @@
     Use 
+%60
 DIDLMeta
@@ -1299,16 +1299,17 @@
 ataError
+%60
  instead
@@ -1545,16 +1545,17 @@
  of%0A    
+%60
 CannotCr
@@ -1570,16 +1570,17 @@
 Metadata
+%60
 . In a f
@@ -1641,16 +1641,17 @@
 lass of 
+%60
 SoCoExce
@@ -1655,16 +1655,17 @@
 xception
+%60
 .%0A    %22%22
@@ -1846,17 +1846,16 @@
  with an
-d
  unknown

Update docstrings:exceptions