<s> '''<STR_LIT>''' <EOL> from suds import WebFault , MethodNotFound , PortNotFound , ServiceNotFound , TypeNotFound , BuildError , SoapHeadersNotPermitted <EOL> ERR_ONVIF_UNKNOWN = <NUM_LIT:1> <EOL> ERR_ONVIF_PROTOCOL = <NUM_LIT:2> <EOL> ERR_ONVIF_WSDL = <NUM_LIT:3> <EOL> ERR_ONVIF_BUILD = <NUM_LIT:4> <EOL> class ONVIFError ( Exception ) : <EOL> def __init__ ( self , err ) : <EOL> if isinstance ( err , ( WebFault , SoapHeadersNotPermitted ) ) : <EOL> self . reason = err . fault . Reason . Text <EOL> self . fault = err . fault <EOL> self . code = ERR_ONVIF_PROTOCOL <EOL> elif isinstance ( err , ( ServiceNotFound , PortNotFound , <EOL> MethodNotFound , TypeNotFound ) ) : <EOL> self . reason = str ( err ) <EOL> self . code = ERR_ONVIF_PROTOCOL <EOL> elif isinstance ( err , BuildError ) : <EOL> self . reason = str ( err ) <EOL> self . code = ERR_ONVIF_BUILD <EOL> else : <EOL> self . reason = '<STR_LIT>' + str ( err ) <EOL> self . code = ERR_ONVIF_UNKNOWN <EOL> def __str__ ( self ) : <EOL> return self . reason </s>
