matrix-org / matrix-bifrost

General purpose bridging with a variety of backends including libpurple and xmpp.js
Apache License 2.0
163 stars 31 forks source link

XMPP errors: provide human-readable reason of join failure #172

Open ge0rg opened 4 years ago

ge0rg commented 4 years ago

When an XMPP client fails to join a room, the error response is

<presence type="error" from="#bridged-room#matrix.org@matrix.org/nickname">
  <x xmlns="http://jabber.org/protocol/muc" />
  <error type="cancel" by="#bridged-room#matrix.org@matrix.org">
    <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
  </error>
</presence>

It would be great to also have a <text> element that would explain the actual cause of the error.

ge0rg commented 4 years ago

So I've tested the new code and the response is this:

<presence id="4c098a267b654351a25ad30578c1bdaf" to="georg@yax.im/poezio-IS8H" xml:lang="en" type="error" from="#bridged-room#matrix.org@matrix.org/Ge0rG">
  <x xmlns="http://jabber.org/protocol/muc"/>
  <error type="cancel" by="#bridged-room#matrix.org@matrix.org">
    <service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
    <text>Failed to join room</text>
  </error>
</presence>

This has two issues:

  1. the <text> element MUST have the urn:ietf:params:xml:ns:xmpp-stanzas namespace (as has service-unavailable) to be interpreted correctly by clients
  2. "Failed to join room" is not actually a description of why it failed to join room.