powered by Jive Software

Smack: StanzaError should have a way to give human-readable error messages


#1

The StanzaError.toString() call will yield a string like “XMPPError: not-allowed - cancel”

This is suitable for internal logging, but it would be great to have a method that returns a human-readable string for the actual error cause, which can be shown in an XMPP client. It should include the <text> element of the error if provided, or an understandable representation of the technical enums otherwise.


#2

That sounds in general like a good idea.

I wonder how a good API would look like, e.g. would the method take a language parameter to show the best matching language? How to determine the “best matching” language?

Not sure if this is feasible, but if it is, then it would sure be great.


#3

I suppose it should take a Locale and try to find the best match for that language. If that fails, you still can return the default language code from the server.

Some discussion with XMPP server admins indicated that normally the server is responsible for providing a human-readable error message, ideally in the xml:lang of the stream. Some implementations are better at this than others, but I suppose we don’t have a way to define the xml:lang when establishing a connection?


#4

Not yet, you are the first to ask for it as far as I remember. It should be trivial to add to connection configuration. Patches welcome.


closed #5

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.