Philipp Hörist pushed to branch master at gajim / python-nbxmpp


Commits:
de423781 by Philipp Hörist at 2025-07-21T21:12:15+02:00
refactor: Remove obsolete error class

- - - - -


2 changed files:

- nbxmpp/structs.py
- nbxmpp/util.py


Changes:

=====================================
nbxmpp/structs.py
=====================================
@@ -922,33 +922,6 @@ class HTTPUploadError(CommonError):
         return self._error_node.getTagAttr("stamp")
 
 
-class StanzaMalformedError(CommonError):
-    def __init__(self, stanza: Protocol, text: str | None) -> None:
-        self._error_node = None
-        self.condition = "stanza-malformed"
-        self.condition_data = None
-        self.app_condition = None
-        self.type = None
-        self.jid = stanza.getFrom()
-        self.id = stanza.getID()
-        self._text: dict[str, str] = {}
-        if text:
-            self._text["en"] = text
-
-    @classmethod
-    def from_string(cls, node_string: str) -> Any:
-        raise NotImplementedError
-
-    def __str__(self) -> str:
-        text = self.get_text("en")
-        if text:
-            text = ": %s" % text
-        return "Received malformed stanza from %s%s" % (self.jid, text)
-
-    def serialize(self) -> str:
-        raise NotImplementedError
-
-
 class StreamError(CommonError):
     def __init__(self, stanza: Protocol) -> None:
         self.condition = stanza.getError()


=====================================
nbxmpp/util.py
=====================================
@@ -47,7 +47,6 @@ from nbxmpp.structs import IqProperties
 from nbxmpp.structs import MessageProperties
 from nbxmpp.structs import PresenceProperties
 from nbxmpp.structs import Properties
-from nbxmpp.structs import StanzaMalformedError
 from nbxmpp.third_party import hsluv
 
 if TYPE_CHECKING:
@@ -117,11 +116,7 @@ def to_xs_boolean(value: bool | None) -> Literal["true", 
"false"]:
 error_classes = {Namespace.HTTPUPLOAD_0: HTTPUploadError}
 
 
-def error_factory(
-    stanza: Protocol, condition: str | None = None, text: str | None = None
-) -> Any:
-    if condition == "stanza-malformed":
-        return StanzaMalformedError(stanza, text)
+def error_factory(stanza: Protocol) -> Any:
     app_namespace = stanza.getAppErrorNamespace()
     return error_classes.get(app_namespace, CommonError)(stanza)
 



View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/de42378136784204d87fee820209ebf32bb6fb6f

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/de42378136784204d87fee820209ebf32bb6fb6f
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to