diff sat/plugins/plugin_xep_0329.py @ 2937:db0890c9c7db

plugin XEP-0329: correctly handle error if something is wrong when getting file from component.
author Goffi <goffi@goffi.org>
date Fri, 03 May 2019 20:46:59 +0200
parents 1fd3ecb3351a
children ab2696e34d29
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0329.py	Fri May 03 20:44:55 2019 +0200
+++ b/sat/plugins/plugin_xep_0329.py	Fri May 03 20:46:59 2019 +0200
@@ -580,6 +580,13 @@
         except exceptions.NotFound:
             self._iqError(client, iq_elt)
             return
+        except exceptions.PermissionError:
+            self._iqError(client, iq_elt, condition='not-allowed')
+            return
+        except Exception as e:
+            log.error(u"internal server error: {e}".format(e=e))
+            self._iqError(client, iq_elt, condition='internal-server-error')
+            return
         iq_result_elt = xmlstream.toResponse(iq_elt, "result")
         query_elt = iq_result_elt.addElement((NS_FIS, "query"))
         query_elt[u"node"] = node_path