mirror of
https://github.com/matrix-construct/construct
synced 2024-07-10 12:38:36 +02:00
modules/client: Update various thrown errors.
This commit is contained in:
parent
38454022cd
commit
9da8e233d6
|
@ -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
|
||||
|
|
|
@ -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."
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue