-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Invalid Matrix s2s errors #4541
Description
Environment
- ejabberd version: 26.01
- Erlang version:
Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 15.2.7.6 - OS: Linux (Alpine Linux)
- Installed from: distro package
Errors from error.log/crash.log
No errors
Bug description
Errors returned from the Matrix s2s module do not follow the Matrix specification, or at least the implied "standard" for them. For example on the invite endpoint /_matrix/federation/v2/invite/{roomId}/{eventId} on invalid room versions:
https://github.com/processone/ejabberd/blob/master/src/mod_matrix_gw.erl#L185
400 Bad Request: unsupported room version
Is specified to return something along the lines of:
{
"errcode": "M_INCOMPATIBLE_ROOM_VERSION",
"error": "unsupported room version",
"room_version": "3"
}(From https://spec.matrix.org/v1.17/server-server-api/#put_matrixfederationv2inviteroomideventid)
Note that not all endpoints have clearly specified errors and even the errcode is extremely fuzzy in many places. https://spec.matrix.org/v1.17/client-server-api/#common-error-codes has a non-exhaustive list of some of the more common error codes as well.
The convention for errors I have gotten from reading the Matrix spec is something along these lines:
{
"errcode": "<error code>",
"error": "<human readable error>"
}Edit: I found the definition of errors, it is also in the c2s API next to the known error codes, I just missed it ^^'
https://spec.matrix.org/v1.17/client-server-api/#standard-error-response