diff --git a/modules/client/login.cc b/modules/client/login.cc index f4fc3e427..88e1b3ca7 100644 --- a/modules/client/login.cc +++ b/modules/client/login.cc @@ -62,15 +62,15 @@ post_login_password(client &client, }; if(!user.is_password(supplied_password)) - throw m::error + throw m::FORBIDDEN { - http::FORBIDDEN, "M_FORBIDDEN", "Access denied." + "Access denied." }; if(!user.is_active()) - throw m::error + throw m::FORBIDDEN { - http::FORBIDDEN, "M_FORBIDDEN", "Access denied." + "Access denied." }; // Generate the access token diff --git a/modules/client/register.cc b/modules/client/register.cc index 50872ec1c..5da7053f8 100644 --- a/modules/client/register.cc +++ b/modules/client/register.cc @@ -52,9 +52,9 @@ try // We only support this for now, for some reason. TODO: XXX if(type && type != "m.login.dummy") - throw m::error + throw m::UNSUPPORTED { - "M_UNSUPPORTED", "Registration '%s' not supported.", type + "Registration '%s' not supported.", type }; // 3.3.1 The local part of the desired Matrix ID. If omitted, the homeserver MUST @@ -126,8 +126,7 @@ catch(const m::INVALID_MXID &e) { throw m::error { - http::BAD_REQUEST, - "M_INVALID_USERNAME", + http::BAD_REQUEST, "M_INVALID_USERNAME", "Not a valid username. Please try again." }; }; @@ -167,10 +166,8 @@ handle_post(client &client, if(kind.empty() || kind == "user") return handle_post_kind_user(client, request); - throw m::error + throw m::UNSUPPORTED { - http::BAD_REQUEST, - "M_UNKNOWN", "Unknown 'kind' of registration specified in query." }; } diff --git a/modules/client/rooms/rooms.cc b/modules/client/rooms/rooms.cc index 2eba52974..253299c13 100644 --- a/modules/client/rooms/rooms.cc +++ b/modules/client/rooms/rooms.cc @@ -96,7 +96,10 @@ put_rooms(client &client, const resource::request &request) if(cmd == "typing") return put__typing(client, request, room_id); - throw m::NOT_FOUND{"/rooms command not found"}; + throw m::NOT_FOUND + { + "/rooms command not found" + }; } resource::method @@ -137,9 +140,9 @@ post_rooms(client &client, if(cmd == "join") return post__join(client, request, room_id); - throw m::error + throw m::NOT_FOUND { - http::MULTIPLE_CHOICES, "M_NOT_FOUND", "/rooms command required" + "/rooms command not found" }; } diff --git a/modules/client/user/filter.cc b/modules/client/user/filter.cc index e5bb5bef6..5f52cabd2 100644 --- a/modules/client/user/filter.cc +++ b/modules/client/user/filter.cc @@ -46,7 +46,7 @@ post__filter(client &client, // (5.2) Required. The id of the user uploading the filter. The access // token must be authorized to make requests for this user id. if(user_id != request.user_id) - throw m::ACCESS_DENIED + throw m::FORBIDDEN { "Trying to post a filter for `%s' but you are `%s'", user_id,