core: fix failure raising with exception classes:

When raising a `Failure` with an exception, the `Exception` class can't be used, it must
be an instance.
This commit is contained in:
Goffi 2026-03-30 12:03:16 +02:00
commit d3113ed2d8

View file

@ -728,7 +728,7 @@ class XEP_0234(BaseApplicationHandler):
try:
file_elt = next(desc_elt.elements(NS_JINGLE_FT, "file"))
except StopIteration:
raise failure.Failure(exceptions.DataError)
raise failure.Failure(exceptions.DataError())
file_data = {"progress_id": self.get_progress_id(session, content_name)}
if senders == self._j.ROLE_RESPONDER:
@ -800,7 +800,7 @@ class XEP_0234(BaseApplicationHandler):
try:
hash_algo = self._hash.parse_hash_used_elt(file_elt)
except exceptions.NotFound:
raise failure.Failure(exceptions.DataError)
raise failure.Failure(exceptions.DataError())
# deferred to track end of transfer
finished_d = content_data["finished_d"] = defer.Deferred()
@ -838,7 +838,7 @@ class XEP_0234(BaseApplicationHandler):
try:
file_data["size"] = int(file_data["size"])
except ValueError:
raise failure.Failure(exceptions.DataError)
raise failure.Failure(exceptions.DataError())
content_data["application_data"]["file_data"] = file_data