2018-07-27 01:49:33 +02:00
|
|
|
from txupnp.util import flatten_keys
|
2018-07-29 04:08:24 +02:00
|
|
|
from txupnp.constants import FAULT, CONTROL
|
2018-07-27 01:49:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
class UPnPError(Exception):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def handle_fault(response):
|
|
|
|
if FAULT in response:
|
2018-07-29 04:08:24 +02:00
|
|
|
fault = flatten_keys(response[FAULT], "{%s}" % CONTROL)
|
2018-07-27 01:49:33 +02:00
|
|
|
raise UPnPError(fault['detail']['UPnPError']['errorDescription'])
|
|
|
|
return response
|