Strict exceptions compat
This commit is contained in:
parent
7fc1645e93
commit
082029cf25
|
@ -138,15 +138,22 @@ proc soapRequest(gateway: TUpnpGateway, actionName: string, args = initTable[str
|
||||||
let request = generateSoapEnveloppe(actionName, gateway.serviceType, args)
|
let request = generateSoapEnveloppe(actionName, gateway.serviceType, args)
|
||||||
result = await postSoap(gateway.controlUri, request, gateway.serviceType & "#" & actionName)
|
result = await postSoap(gateway.controlUri, request, gateway.serviceType & "#" & actionName)
|
||||||
|
|
||||||
try:
|
result.xmlTree =
|
||||||
result.xmlTree = parseXml(result.body)["s:Body"]
|
try:
|
||||||
if not isNil(result.xmlTree):
|
parseXml(result.body)
|
||||||
result.xmlTree = result.xmlTree[0]
|
except XmlError as exc:
|
||||||
|
trace "Cannot parse response XML", resp = result.body
|
||||||
|
return result
|
||||||
|
except Exception as exc:
|
||||||
|
#borken exception tracking on parseXml
|
||||||
|
doAssert false
|
||||||
|
nil
|
||||||
|
result.xmlTree = result.xmlTree["s:Body"]
|
||||||
|
if not isNil(result.xmlTree):
|
||||||
|
result.xmlTree = result.xmlTree[0]
|
||||||
|
|
||||||
for child in result.xmlTree:
|
for child in result.xmlTree:
|
||||||
result.response[child.tag.toLower()] = child.getStr()
|
result.response[child.tag.toLower()] = child.getStr()
|
||||||
except XmlError as exc:
|
|
||||||
trace "Cannot parse response XML", resp = result.body
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
# UPNP
|
# UPNP
|
||||||
|
@ -215,6 +222,10 @@ proc tryGatewayLocation(tupnp: TUpnpSession, location: Uri) {.async.} =
|
||||||
except XmlError as exc:
|
except XmlError as exc:
|
||||||
debug "Can't decode XML from location", err = exc.msg
|
debug "Can't decode XML from location", err = exc.msg
|
||||||
return
|
return
|
||||||
|
except Exception as exc:
|
||||||
|
#borken exception tracking on parseXml
|
||||||
|
doAssert false
|
||||||
|
nil
|
||||||
|
|
||||||
for service in pageXml.getAllRecur("service"):
|
for service in pageXml.getAllRecur("service"):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue