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
3 changed files with 5 additions and 5 deletions

View file

@ -207,7 +207,7 @@ class Params(object):
self.host.disconnect(profile)
else:
log.info(_("Trying to delete a connected profile"))
return defer.fail(Failure(exceptions.ProfileConnected))
return defer.fail(Failure(exceptions.ProfileConnected()))
return self.storage.delete_profile(profile)
def get_profile_name(self, profile_key, return_profile_keys=False):

View file

@ -224,7 +224,7 @@ class MiscAccount(object):
raise exceptions.DataError
if profile.lower() in RESERVED_LIST:
return defer.fail(Failure(exceptions.ConflictError))
return defer.fail(Failure(exceptions.ConflictError()))
d = self.host.memory.create_profile(profile, password)
d.addCallback(lambda __: self.profile_created(password, jid_s, profile))

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