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.
Edit: apparently you can’t comment any more after a month, so editing this in. The same kind of problem exists with StreamError where a long and ugly mandatory “explanation” link is added to the human readable part in the StreamErrorException constructor.
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.
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?