diff --git a/CHANGELOG.md b/CHANGELOG.md index da68bfe2..1b657e04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Improvements: * Add an `Error` type that represents the well-known errors in the client-server API + * the response deserialization code will try to create an instance of this type from http responses that indicate an error * Add OpenID token request endpoint. * Add `r0::client_exchange::send_event_to_device` (introduced in r0.3.0) * Add endpoints to retrieve account_data (introduced in r0.5.0) @@ -14,7 +15,7 @@ Improvements: Breaking changes: -* Update ruma-api to 0.14.0 +* Update ruma-api to 0.15.0 * Fix `r0::session::get_login_types` * Add `allow_remote` parameter to `r0::media::get_content` * Add missing parameters for `r0::room::create_room` diff --git a/Cargo.toml b/Cargo.toml index 1b45821c..3b152118 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,10 +15,10 @@ edition = "2018" [dependencies] http = "0.2.0" js_int = { version = "0.1.3", features = ["serde"] } -ruma-api = "0.14.0" +ruma-api = "0.15.0-dev.1" ruma-events = "0.17.0" ruma-identifiers = "0.14.1" serde = { version = "1.0.104", features = ["derive"] } serde_json = "1.0.48" -strum = { version = "0.17.1", features = ["derive"] } +strum = { version = "0.18.0", features = ["derive"] } url = { version = "2.1.1", features = ["serde"] } diff --git a/src/error.rs b/src/error.rs index b7569d4d..999f40aa 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,5 +1,6 @@ //! Errors that can be sent from the homeserver. +use ruma_api::{error::ResponseDeserializationError, EndpointError}; use serde::{Deserialize, Serialize}; /// An enum for the error kind. Items may contain additional information. @@ -117,6 +118,17 @@ pub struct Error { pub status_code: http::StatusCode, } +impl EndpointError for Error { + fn try_from_response( + response: http::Response>, + ) -> Result { + match serde_json::from_slice::(response.body()) { + Ok(error_body) => Ok(error_body.into_error(response.status())), + Err(de_error) => Err(ResponseDeserializationError::new(de_error, response)), + } + } +} + impl From for ErrorBody { fn from(error: Error) -> Self { Self { diff --git a/src/lib.rs b/src/lib.rs index 9d8e94f7..7c2ed9c0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -13,3 +13,5 @@ pub mod r0; pub mod unversioned; mod serde; + +pub use error::Error; diff --git a/src/r0/account/bind_3pid.rs b/src/r0/account/bind_3pid.rs index e8603f6e..81bd7c46 100644 --- a/src/r0/account/bind_3pid.rs +++ b/src/r0/account/bind_3pid.rs @@ -26,4 +26,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/account/change_password.rs b/src/r0/account/change_password.rs index 96989561..abb83411 100644 --- a/src/r0/account/change_password.rs +++ b/src/r0/account/change_password.rs @@ -22,4 +22,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/account/deactivate.rs b/src/r0/account/deactivate.rs index 173f9705..33af8c3a 100644 --- a/src/r0/account/deactivate.rs +++ b/src/r0/account/deactivate.rs @@ -28,4 +28,6 @@ ruma_api! { /// Result of unbind operation. pub id_server_unbind_result: ThirdPartyIdRemovalStatus, } + + error: crate::Error } diff --git a/src/r0/account/delete_3pid.rs b/src/r0/account/delete_3pid.rs index 4af420b6..ad95fd7b 100644 --- a/src/r0/account/delete_3pid.rs +++ b/src/r0/account/delete_3pid.rs @@ -30,4 +30,6 @@ ruma_api! { pub id_server_unbind_result: ThirdPartyIdRemovalStatus, } + error: crate::Error + } diff --git a/src/r0/account/get_username_availability.rs b/src/r0/account/get_username_availability.rs index c2fc34ff..ffe1be74 100644 --- a/src/r0/account/get_username_availability.rs +++ b/src/r0/account/get_username_availability.rs @@ -23,4 +23,6 @@ ruma_api! { /// This should always be true when the server replies with 200 OK. pub available: bool } + + error: crate::Error } diff --git a/src/r0/account/register.rs b/src/r0/account/register.rs index 3ab0a9c5..76b1fe6e 100644 --- a/src/r0/account/register.rs +++ b/src/r0/account/register.rs @@ -73,6 +73,8 @@ ruma_api! { /// Will be the same as the corresponding parameter in the request, if one was specified. pub device_id: DeviceId, } + + error: crate::Error } /// The kind of account being registered. diff --git a/src/r0/account/request_3pid_management_token_via_email.rs b/src/r0/account/request_3pid_management_token_via_email.rs index 5485c1fa..dc6ceb7e 100644 --- a/src/r0/account/request_3pid_management_token_via_email.rs +++ b/src/r0/account/request_3pid_management_token_via_email.rs @@ -38,4 +38,6 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] pub submit_url: Option } + + error: crate::Error } diff --git a/src/r0/account/request_3pid_management_token_via_msisdn.rs b/src/r0/account/request_3pid_management_token_via_msisdn.rs index 0d0ef810..f7e04125 100644 --- a/src/r0/account/request_3pid_management_token_via_msisdn.rs +++ b/src/r0/account/request_3pid_management_token_via_msisdn.rs @@ -40,4 +40,6 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] pub submit_url: Option } + + error: crate::Error } diff --git a/src/r0/account/request_openid_token.rs b/src/r0/account/request_openid_token.rs index b3b96bcc..637524a5 100644 --- a/src/r0/account/request_openid_token.rs +++ b/src/r0/account/request_openid_token.rs @@ -33,6 +33,8 @@ ruma_api! { #[serde(with = "crate::serde::duration::secs")] pub expires_in: Duration, } + + error: crate::Error } /// Access token types. diff --git a/src/r0/account/request_password_change_token_via_email.rs b/src/r0/account/request_password_change_token_via_email.rs index 0ddbbf77..ae7096c6 100644 --- a/src/r0/account/request_password_change_token_via_email.rs +++ b/src/r0/account/request_password_change_token_via_email.rs @@ -38,4 +38,6 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] pub submit_url: Option } + + error: crate::Error } diff --git a/src/r0/account/request_password_change_token_via_msisdn.rs b/src/r0/account/request_password_change_token_via_msisdn.rs index 35eaf27f..40f865a7 100644 --- a/src/r0/account/request_password_change_token_via_msisdn.rs +++ b/src/r0/account/request_password_change_token_via_msisdn.rs @@ -34,4 +34,6 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] pub submit_url: Option } + + error: crate::Error } diff --git a/src/r0/account/request_registration_token_via_email.rs b/src/r0/account/request_registration_token_via_email.rs index 2b10eafc..38468bfd 100644 --- a/src/r0/account/request_registration_token_via_email.rs +++ b/src/r0/account/request_registration_token_via_email.rs @@ -38,4 +38,6 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] pub submit_url: Option } + + error: crate::Error } diff --git a/src/r0/account/request_registration_token_via_msisdn.rs b/src/r0/account/request_registration_token_via_msisdn.rs index dc8dfa6d..cce91ba7 100644 --- a/src/r0/account/request_registration_token_via_msisdn.rs +++ b/src/r0/account/request_registration_token_via_msisdn.rs @@ -40,4 +40,6 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] pub submit_url: Option } + + error: crate::Error } diff --git a/src/r0/account/unbind_3pid.rs b/src/r0/account/unbind_3pid.rs index d493a179..fec859cb 100644 --- a/src/r0/account/unbind_3pid.rs +++ b/src/r0/account/unbind_3pid.rs @@ -29,4 +29,6 @@ ruma_api! { /// Result of unbind operation. pub id_server_unbind_result: ThirdPartyIdRemovalStatus, } + + error: crate::Error } diff --git a/src/r0/account/whoami.rs b/src/r0/account/whoami.rs index 8ae9414f..0f4f3ea5 100644 --- a/src/r0/account/whoami.rs +++ b/src/r0/account/whoami.rs @@ -18,4 +18,6 @@ ruma_api! { /// The id of the user that owns the access token. pub user_id: String, } + + error: crate::Error } diff --git a/src/r0/alias/create_alias.rs b/src/r0/alias/create_alias.rs index 55a9e30c..9770d22e 100644 --- a/src/r0/alias/create_alias.rs +++ b/src/r0/alias/create_alias.rs @@ -22,4 +22,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/alias/delete_alias.rs b/src/r0/alias/delete_alias.rs index dc8dfd5f..cebc3cd7 100644 --- a/src/r0/alias/delete_alias.rs +++ b/src/r0/alias/delete_alias.rs @@ -20,4 +20,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/alias/get_alias.rs b/src/r0/alias/get_alias.rs index 93dca32a..d2d49fb4 100644 --- a/src/r0/alias/get_alias.rs +++ b/src/r0/alias/get_alias.rs @@ -25,4 +25,6 @@ ruma_api! { /// A list of servers that are aware of this room ID. pub servers: Vec, } + + error: crate::Error } diff --git a/src/r0/appservice/set_room_visibility.rs b/src/r0/appservice/set_room_visibility.rs index ea188fca..5df0c5d7 100644 --- a/src/r0/appservice/set_room_visibility.rs +++ b/src/r0/appservice/set_room_visibility.rs @@ -27,4 +27,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/capabilities/get_capabilities.rs b/src/r0/capabilities/get_capabilities.rs index b657e207..9345280c 100644 --- a/src/r0/capabilities/get_capabilities.rs +++ b/src/r0/capabilities/get_capabilities.rs @@ -21,6 +21,8 @@ ruma_api! { /// The capabilities the server supports pub capabilities: Capabilities, } + + error: crate::Error } /// Contains information about all the capabilities that the server supports. diff --git a/src/r0/client_exchange/send_event_to_device.rs b/src/r0/client_exchange/send_event_to_device.rs index 0813ab3b..afef7244 100644 --- a/src/r0/client_exchange/send_event_to_device.rs +++ b/src/r0/client_exchange/send_event_to_device.rs @@ -33,4 +33,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/config/get_global_account_data.rs b/src/r0/config/get_global_account_data.rs index b5a01559..611781c8 100644 --- a/src/r0/config/get_global_account_data.rs +++ b/src/r0/config/get_global_account_data.rs @@ -29,4 +29,6 @@ ruma_api! { #[wrap_incoming(with EventResult)] pub account_data: only::Event, } + + error: crate::Error } diff --git a/src/r0/config/get_room_account_data.rs b/src/r0/config/get_room_account_data.rs index dc76dd0e..7c79bad3 100644 --- a/src/r0/config/get_room_account_data.rs +++ b/src/r0/config/get_room_account_data.rs @@ -32,4 +32,6 @@ ruma_api! { #[wrap_incoming(with EventResult)] pub account_data: only::Event, } + + error: crate::Error } diff --git a/src/r0/config/set_global_account_data.rs b/src/r0/config/set_global_account_data.rs index 0c9a4751..363f7f6d 100644 --- a/src/r0/config/set_global_account_data.rs +++ b/src/r0/config/set_global_account_data.rs @@ -31,4 +31,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/config/set_room_account_data.rs b/src/r0/config/set_room_account_data.rs index 86e3c343..82cc64c4 100644 --- a/src/r0/config/set_room_account_data.rs +++ b/src/r0/config/set_room_account_data.rs @@ -34,4 +34,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/contact/get_contacts.rs b/src/r0/contact/get_contacts.rs index 5c7837c6..a67b2994 100644 --- a/src/r0/contact/get_contacts.rs +++ b/src/r0/contact/get_contacts.rs @@ -21,6 +21,8 @@ ruma_api! { /// account. pub threepids: Vec, } + + error: crate::Error } /// An identifier external to Matrix. diff --git a/src/r0/contact/request_contact_verification_token.rs b/src/r0/contact/request_contact_verification_token.rs index eb12902c..ef8e4903 100644 --- a/src/r0/contact/request_contact_verification_token.rs +++ b/src/r0/contact/request_contact_verification_token.rs @@ -26,4 +26,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/context/get_context.rs b/src/r0/context/get_context.rs index c0f753d3..dc6ff9a1 100644 --- a/src/r0/context/get_context.rs +++ b/src/r0/context/get_context.rs @@ -56,4 +56,6 @@ ruma_api! { #[wrap_incoming(only::StateEvent with EventResult)] pub state: Vec, } + + error: crate::Error } diff --git a/src/r0/device/delete_device.rs b/src/r0/device/delete_device.rs index 478a7064..b99b8592 100644 --- a/src/r0/device/delete_device.rs +++ b/src/r0/device/delete_device.rs @@ -24,4 +24,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/device/delete_devices.rs b/src/r0/device/delete_devices.rs index 3ce01871..ef74419a 100644 --- a/src/r0/device/delete_devices.rs +++ b/src/r0/device/delete_devices.rs @@ -24,4 +24,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/device/get_device.rs b/src/r0/device/get_device.rs index 0b17c6b8..7095162b 100644 --- a/src/r0/device/get_device.rs +++ b/src/r0/device/get_device.rs @@ -25,4 +25,6 @@ ruma_api! { #[ruma_api(body)] pub device: Device, } + + error: crate::Error } diff --git a/src/r0/device/get_devices.rs b/src/r0/device/get_devices.rs index 4419d369..b9f8d474 100644 --- a/src/r0/device/get_devices.rs +++ b/src/r0/device/get_devices.rs @@ -18,4 +18,6 @@ ruma_api! { response { devices: Vec, } + + error: crate::Error } diff --git a/src/r0/device/update_device.rs b/src/r0/device/update_device.rs index 9d4328ff..239dd07d 100644 --- a/src/r0/device/update_device.rs +++ b/src/r0/device/update_device.rs @@ -24,4 +24,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/directory/get_public_rooms.rs b/src/r0/directory/get_public_rooms.rs index 2f565cda..c7a54495 100644 --- a/src/r0/directory/get_public_rooms.rs +++ b/src/r0/directory/get_public_rooms.rs @@ -42,4 +42,6 @@ ruma_api! { /// An estimate on the total number of public rooms, if the server has an estimate. pub total_room_count_estimate: Option, } + + error: crate::Error } diff --git a/src/r0/directory/get_public_rooms_filtered.rs b/src/r0/directory/get_public_rooms_filtered.rs index b63b0347..95d4d152 100644 --- a/src/r0/directory/get_public_rooms_filtered.rs +++ b/src/r0/directory/get_public_rooms_filtered.rs @@ -44,6 +44,8 @@ ruma_api! { /// An estimate on the total number of public rooms, if the server has an estimate. pub total_room_count_estimate: Option, } + + error: crate::Error } /// A filter for public rooms lists diff --git a/src/r0/filter/create_filter.rs b/src/r0/filter/create_filter.rs index e6486860..b11d324c 100644 --- a/src/r0/filter/create_filter.rs +++ b/src/r0/filter/create_filter.rs @@ -30,4 +30,6 @@ ruma_api! { /// The ID of the filter that was created. pub filter_id: String, } + + error: crate::Error } diff --git a/src/r0/filter/get_filter.rs b/src/r0/filter/get_filter.rs index e074b15c..0209d6c3 100644 --- a/src/r0/filter/get_filter.rs +++ b/src/r0/filter/get_filter.rs @@ -29,4 +29,6 @@ ruma_api! { #[ruma_api(body)] pub filter: FilterDefinition, } + + error: crate::Error } diff --git a/src/r0/keys/claim_keys.rs b/src/r0/keys/claim_keys.rs index 3b14c0a2..0275fd1b 100644 --- a/src/r0/keys/claim_keys.rs +++ b/src/r0/keys/claim_keys.rs @@ -39,4 +39,6 @@ ruma_api! { /// One-time keys for the queried devices. pub one_time_keys: HashMap>>, } + + error: crate::Error } diff --git a/src/r0/keys/get_key_changes.rs b/src/r0/keys/get_key_changes.rs index f8b8c22a..fb979f8d 100644 --- a/src/r0/keys/get_key_changes.rs +++ b/src/r0/keys/get_key_changes.rs @@ -33,4 +33,6 @@ ruma_api! { /// encrypted rooms they previously shared with the user. pub left: Vec } + + error: crate::Error } diff --git a/src/r0/keys/get_keys.rs b/src/r0/keys/get_keys.rs index 526a3359..b6049a39 100644 --- a/src/r0/keys/get_keys.rs +++ b/src/r0/keys/get_keys.rs @@ -43,4 +43,6 @@ ruma_api! { /// Information on the queried devices. pub device_keys: HashMap>, } + + error: crate::Error } diff --git a/src/r0/keys/upload_keys.rs b/src/r0/keys/upload_keys.rs index 64b692ac..d99074b6 100644 --- a/src/r0/keys/upload_keys.rs +++ b/src/r0/keys/upload_keys.rs @@ -32,4 +32,6 @@ ruma_api! { /// type currently held on the server for this device. pub one_time_key_counts: HashMap } + + error: crate::Error } diff --git a/src/r0/media/create_content.rs b/src/r0/media/create_content.rs index 2a9f8eea..959e8611 100644 --- a/src/r0/media/create_content.rs +++ b/src/r0/media/create_content.rs @@ -29,4 +29,6 @@ ruma_api! { /// The MXC URI for the uploaded content. pub content_uri: String, } + + error: crate::Error } diff --git a/src/r0/media/get_content.rs b/src/r0/media/get_content.rs index accb0169..22ec5d2f 100644 --- a/src/r0/media/get_content.rs +++ b/src/r0/media/get_content.rs @@ -36,4 +36,6 @@ ruma_api! { #[ruma_api(header = CONTENT_DISPOSITION)] pub content_disposition: String, } + + error: crate::Error } diff --git a/src/r0/media/get_content_as_filename.rs b/src/r0/media/get_content_as_filename.rs index 140301ea..f97692d1 100644 --- a/src/r0/media/get_content_as_filename.rs +++ b/src/r0/media/get_content_as_filename.rs @@ -39,4 +39,6 @@ ruma_api! { #[ruma_api(header = CONTENT_DISPOSITION)] pub content_disposition: String, } + + error: crate::Error } diff --git a/src/r0/media/get_content_thumbnail.rs b/src/r0/media/get_content_thumbnail.rs index 532f153f..567631d9 100644 --- a/src/r0/media/get_content_thumbnail.rs +++ b/src/r0/media/get_content_thumbnail.rs @@ -57,4 +57,6 @@ ruma_api! { #[ruma_api(body)] pub file: Vec, } + + error: crate::Error } diff --git a/src/r0/media/get_media_config.rs b/src/r0/media/get_media_config.rs index 84008948..ff4aba2a 100644 --- a/src/r0/media/get_media_config.rs +++ b/src/r0/media/get_media_config.rs @@ -20,4 +20,6 @@ ruma_api! { #[serde(rename = "m.upload.size")] pub upload_size: UInt, } + + error: crate::Error } diff --git a/src/r0/media/get_media_preview.rs b/src/r0/media/get_media_preview.rs index c2fcdae8..13dd4a5c 100644 --- a/src/r0/media/get_media_preview.rs +++ b/src/r0/media/get_media_preview.rs @@ -31,4 +31,6 @@ ruma_api! { #[ruma_api(body)] pub data: Option, } + + error: crate::Error } diff --git a/src/r0/membership/ban_user.rs b/src/r0/membership/ban_user.rs index 01f6636c..20ccacbc 100644 --- a/src/r0/membership/ban_user.rs +++ b/src/r0/membership/ban_user.rs @@ -25,4 +25,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/membership/forget_room.rs b/src/r0/membership/forget_room.rs index 360a4a51..ffabe3cd 100644 --- a/src/r0/membership/forget_room.rs +++ b/src/r0/membership/forget_room.rs @@ -20,4 +20,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/membership/get_member_events.rs b/src/r0/membership/get_member_events.rs index c4b589d2..bddbf71d 100644 --- a/src/r0/membership/get_member_events.rs +++ b/src/r0/membership/get_member_events.rs @@ -25,4 +25,6 @@ ruma_api! { #[wrap_incoming(MemberEvent with EventResult)] pub chunk: Vec } + + error: crate::Error } diff --git a/src/r0/membership/invite_user.rs b/src/r0/membership/invite_user.rs index bac550e8..0d0de7bf 100644 --- a/src/r0/membership/invite_user.rs +++ b/src/r0/membership/invite_user.rs @@ -32,6 +32,8 @@ ruma_api! { } response {} + + error: crate::Error } /// Distinguishes between invititations by Matrix or third party identifiers. diff --git a/src/r0/membership/join_room_by_id.rs b/src/r0/membership/join_room_by_id.rs index 81fdca02..6555f6fc 100644 --- a/src/r0/membership/join_room_by_id.rs +++ b/src/r0/membership/join_room_by_id.rs @@ -29,4 +29,6 @@ ruma_api! { /// The room that the user joined. pub room_id: RoomId, } + + error: crate::Error } diff --git a/src/r0/membership/join_room_by_id_or_alias.rs b/src/r0/membership/join_room_by_id_or_alias.rs index bd0bf5e8..1dfd2f68 100644 --- a/src/r0/membership/join_room_by_id_or_alias.rs +++ b/src/r0/membership/join_room_by_id_or_alias.rs @@ -29,4 +29,6 @@ ruma_api! { /// The room that the user joined. pub room_id: RoomId, } + + error: crate::Error } diff --git a/src/r0/membership/joined_members.rs b/src/r0/membership/joined_members.rs index 614c0809..e4727d27 100644 --- a/src/r0/membership/joined_members.rs +++ b/src/r0/membership/joined_members.rs @@ -27,6 +27,8 @@ ruma_api! { /// the ID of each room in which the user has joined membership. pub joined: HashMap, } + + error: crate::Error } // TODO: Find out whether display_name and avatar_url are optional diff --git a/src/r0/membership/joined_rooms.rs b/src/r0/membership/joined_rooms.rs index c1266525..e9f84431 100644 --- a/src/r0/membership/joined_rooms.rs +++ b/src/r0/membership/joined_rooms.rs @@ -20,4 +20,6 @@ ruma_api! { /// the ID of each room in which the user has joined membership. pub joined_rooms: Vec, } + + error: crate::Error } diff --git a/src/r0/membership/kick_user.rs b/src/r0/membership/kick_user.rs index 1d70a8e0..d9276324 100644 --- a/src/r0/membership/kick_user.rs +++ b/src/r0/membership/kick_user.rs @@ -25,4 +25,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/membership/leave_room.rs b/src/r0/membership/leave_room.rs index 50e2a398..d9487759 100644 --- a/src/r0/membership/leave_room.rs +++ b/src/r0/membership/leave_room.rs @@ -20,4 +20,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/membership/unban_user.rs b/src/r0/membership/unban_user.rs index 20eda03f..27bd9e93 100644 --- a/src/r0/membership/unban_user.rs +++ b/src/r0/membership/unban_user.rs @@ -22,4 +22,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/message/create_message_event.rs b/src/r0/message/create_message_event.rs index da5f2f76..4849641d 100644 --- a/src/r0/message/create_message_event.rs +++ b/src/r0/message/create_message_event.rs @@ -38,4 +38,6 @@ ruma_api! { /// A unique identifier for the event. pub event_id: EventId, } + + error: crate::Error } diff --git a/src/r0/message/get_message_events.rs b/src/r0/message/get_message_events.rs index c7851020..cd8fa749 100644 --- a/src/r0/message/get_message_events.rs +++ b/src/r0/message/get_message_events.rs @@ -61,6 +61,8 @@ ruma_api! { /// The token the pagination ends at. pub end: String, } + + error: crate::Error } /// The direction to return events from. diff --git a/src/r0/presence/get_presence.rs b/src/r0/presence/get_presence.rs index 2a32e1a4..9e344566 100644 --- a/src/r0/presence/get_presence.rs +++ b/src/r0/presence/get_presence.rs @@ -36,4 +36,6 @@ ruma_api! { /// The user's presence state. pub presence: PresenceState, } + + error: crate::Error } diff --git a/src/r0/presence/set_presence.rs b/src/r0/presence/set_presence.rs index 5d0aa325..b295b5a5 100644 --- a/src/r0/presence/set_presence.rs +++ b/src/r0/presence/set_presence.rs @@ -26,4 +26,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/profile/get_avatar_url.rs b/src/r0/profile/get_avatar_url.rs index 8f91296c..d6fa0cb5 100644 --- a/src/r0/profile/get_avatar_url.rs +++ b/src/r0/profile/get_avatar_url.rs @@ -24,4 +24,6 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] pub avatar_url: Option } + + error: crate::Error } diff --git a/src/r0/profile/get_display_name.rs b/src/r0/profile/get_display_name.rs index 47d033a4..9f4aa150 100644 --- a/src/r0/profile/get_display_name.rs +++ b/src/r0/profile/get_display_name.rs @@ -24,4 +24,6 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] pub displayname: Option } + + error: crate::Error } diff --git a/src/r0/profile/get_profile.rs b/src/r0/profile/get_profile.rs index 54a2326f..2aa014b2 100644 --- a/src/r0/profile/get_profile.rs +++ b/src/r0/profile/get_profile.rs @@ -27,4 +27,6 @@ ruma_api! { #[serde(skip_serializing_if = "Option::is_none")] pub displayname: Option, } + + error: crate::Error } diff --git a/src/r0/profile/set_avatar_url.rs b/src/r0/profile/set_avatar_url.rs index c78edd32..6333f516 100644 --- a/src/r0/profile/set_avatar_url.rs +++ b/src/r0/profile/set_avatar_url.rs @@ -22,4 +22,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/profile/set_display_name.rs b/src/r0/profile/set_display_name.rs index 37bf8230..93898a7e 100644 --- a/src/r0/profile/set_display_name.rs +++ b/src/r0/profile/set_display_name.rs @@ -23,4 +23,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/push/delete_pushrule.rs b/src/r0/push/delete_pushrule.rs index 8062668f..a5a35377 100644 --- a/src/r0/push/delete_pushrule.rs +++ b/src/r0/push/delete_pushrule.rs @@ -29,4 +29,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/push/get_notifications.rs b/src/r0/push/get_notifications.rs index 781dbcdd..6774e8a2 100644 --- a/src/r0/push/get_notifications.rs +++ b/src/r0/push/get_notifications.rs @@ -47,6 +47,8 @@ ruma_api! { #[wrap_incoming(Notification)] pub notifications: Vec, } + + error: crate::Error } /// Represents a notification diff --git a/src/r0/push/get_pushers.rs b/src/r0/push/get_pushers.rs index b267c9ed..729a62e7 100644 --- a/src/r0/push/get_pushers.rs +++ b/src/r0/push/get_pushers.rs @@ -20,4 +20,6 @@ ruma_api! { /// An array containing the current pushers for the user. pub pushers: Vec } + + error: crate::Error } diff --git a/src/r0/push/get_pushrule.rs b/src/r0/push/get_pushrule.rs index c1377404..482e8dd5 100644 --- a/src/r0/push/get_pushrule.rs +++ b/src/r0/push/get_pushrule.rs @@ -33,4 +33,6 @@ ruma_api! { #[ruma_api(body)] pub rule: PushRule } + + error: crate::Error } diff --git a/src/r0/push/get_pushrule_actions.rs b/src/r0/push/get_pushrule_actions.rs index ca0ad899..0fd7b048 100644 --- a/src/r0/push/get_pushrule_actions.rs +++ b/src/r0/push/get_pushrule_actions.rs @@ -32,4 +32,6 @@ ruma_api! { /// The actions to perform for this rule. pub actions: Vec } + + error: crate::Error } diff --git a/src/r0/push/get_pushrule_enabled.rs b/src/r0/push/get_pushrule_enabled.rs index b0800888..ae9fcfbf 100644 --- a/src/r0/push/get_pushrule_enabled.rs +++ b/src/r0/push/get_pushrule_enabled.rs @@ -32,4 +32,6 @@ ruma_api! { /// Whether the push rule is enabled or not. pub enabled: bool } + + error: crate::Error } diff --git a/src/r0/push/get_pushrules_all.rs b/src/r0/push/get_pushrules_all.rs index 73273c25..6954811f 100644 --- a/src/r0/push/get_pushrules_all.rs +++ b/src/r0/push/get_pushrules_all.rs @@ -22,4 +22,6 @@ ruma_api! { /// The global ruleset pub global: HashMap> } + + error: crate::Error } diff --git a/src/r0/push/get_pushrules_global_scope.rs b/src/r0/push/get_pushrules_global_scope.rs index b8fdc2ff..fbefecfc 100644 --- a/src/r0/push/get_pushrules_global_scope.rs +++ b/src/r0/push/get_pushrules_global_scope.rs @@ -23,4 +23,6 @@ ruma_api! { #[ruma_api(body)] pub global: HashMap>, } + + error: crate::Error } diff --git a/src/r0/push/set_pusher.rs b/src/r0/push/set_pusher.rs index 53a48bda..17c90599 100644 --- a/src/r0/push/set_pusher.rs +++ b/src/r0/push/set_pusher.rs @@ -27,4 +27,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/push/set_pushrule.rs b/src/r0/push/set_pushrule.rs index acaf16a9..f1066c3f 100644 --- a/src/r0/push/set_pushrule.rs +++ b/src/r0/push/set_pushrule.rs @@ -49,4 +49,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/push/set_pushrule_actions.rs b/src/r0/push/set_pushrule_actions.rs index 2b1a9be0..d3088b63 100644 --- a/src/r0/push/set_pushrule_actions.rs +++ b/src/r0/push/set_pushrule_actions.rs @@ -32,4 +32,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/push/set_pushrule_enabled.rs b/src/r0/push/set_pushrule_enabled.rs index 68638a83..d0a04002 100644 --- a/src/r0/push/set_pushrule_enabled.rs +++ b/src/r0/push/set_pushrule_enabled.rs @@ -32,4 +32,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/read_marker/set_read_marker.rs b/src/r0/read_marker/set_read_marker.rs index e7dbd31d..5ef38743 100644 --- a/src/r0/read_marker/set_read_marker.rs +++ b/src/r0/read_marker/set_read_marker.rs @@ -32,4 +32,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/receipt/create_receipt.rs b/src/r0/receipt/create_receipt.rs index d2e75699..9a963dc9 100644 --- a/src/r0/receipt/create_receipt.rs +++ b/src/r0/receipt/create_receipt.rs @@ -29,6 +29,8 @@ ruma_api! { } response {} + + error: crate::Error } /// The type of receipt. diff --git a/src/r0/redact/redact_event.rs b/src/r0/redact/redact_event.rs index b79f813c..fde2818c 100644 --- a/src/r0/redact/redact_event.rs +++ b/src/r0/redact/redact_event.rs @@ -34,4 +34,6 @@ ruma_api! { /// The ID of the redacted event. pub event_id: EventId, } + + error: crate::Error } diff --git a/src/r0/room/create_room.rs b/src/r0/room/create_room.rs index 5b81627c..7af56f2d 100644 --- a/src/r0/room/create_room.rs +++ b/src/r0/room/create_room.rs @@ -72,6 +72,8 @@ ruma_api! { /// The created room's ID. pub room_id: RoomId, } + + error: crate::Error } /// Extra options to be added to the `m.room.create` event. diff --git a/src/r0/room/get_room_event.rs b/src/r0/room/get_room_event.rs index 78b4593e..29450ae4 100644 --- a/src/r0/room/get_room_event.rs +++ b/src/r0/room/get_room_event.rs @@ -28,4 +28,6 @@ ruma_api! { #[wrap_incoming(with EventResult)] pub event: all::RoomEvent, } + + error: crate::Error } diff --git a/src/r0/room/report_content.rs b/src/r0/room/report_content.rs index ecb07ec6..40ef14d1 100644 --- a/src/r0/room/report_content.rs +++ b/src/r0/room/report_content.rs @@ -28,4 +28,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/room/upgrade_room.rs b/src/r0/room/upgrade_room.rs index 91b60b01..5a152b3e 100644 --- a/src/r0/room/upgrade_room.rs +++ b/src/r0/room/upgrade_room.rs @@ -25,4 +25,6 @@ ruma_api! { /// ID of the new room. pub replacement_room: RoomId, } + + error: crate::Error } diff --git a/src/r0/search/search_events.rs b/src/r0/search/search_events.rs index e9b74a9f..441cb58e 100644 --- a/src/r0/search/search_events.rs +++ b/src/r0/search/search_events.rs @@ -35,6 +35,8 @@ ruma_api! { #[wrap_incoming] pub search_categories: ResultCategories, } + + error: crate::Error } /// Categories of events that can be searched for. diff --git a/src/r0/server/get_user_info.rs b/src/r0/server/get_user_info.rs index c5a59d64..1cb6aef2 100644 --- a/src/r0/server/get_user_info.rs +++ b/src/r0/server/get_user_info.rs @@ -29,6 +29,8 @@ ruma_api! { /// A map of the user's device identifiers to information about that device. pub devices: HashMap, } + + error: crate::Error } /// Information about a connection in a user session. diff --git a/src/r0/session/get_login_types.rs b/src/r0/session/get_login_types.rs index 764a3b25..8e323a08 100644 --- a/src/r0/session/get_login_types.rs +++ b/src/r0/session/get_login_types.rs @@ -19,6 +19,8 @@ ruma_api! { /// The homeserver's supported login types. pub flows: Vec } + + error: crate::Error } /// An authentication mechanism. diff --git a/src/r0/session/login.rs b/src/r0/session/login.rs index d69fbe42..ab7af74d 100644 --- a/src/r0/session/login.rs +++ b/src/r0/session/login.rs @@ -53,6 +53,8 @@ ruma_api! { /// If present, clients SHOULD use the provided object to reconfigure themselves. pub well_known: Option, } + + error: crate::Error } /// Identification information for the user. diff --git a/src/r0/session/logout.rs b/src/r0/session/logout.rs index 5f3b5090..1c33d716 100644 --- a/src/r0/session/logout.rs +++ b/src/r0/session/logout.rs @@ -15,4 +15,6 @@ ruma_api! { request {} response {} + + error: crate::Error } diff --git a/src/r0/session/logout_all.rs b/src/r0/session/logout_all.rs index b8613c05..b70493b9 100644 --- a/src/r0/session/logout_all.rs +++ b/src/r0/session/logout_all.rs @@ -15,4 +15,6 @@ ruma_api! { request {} response {} + + error: crate::Error } diff --git a/src/r0/session/sso_login.rs b/src/r0/session/sso_login.rs index af6c42d9..b043698d 100644 --- a/src/r0/session/sso_login.rs +++ b/src/r0/session/sso_login.rs @@ -25,4 +25,6 @@ ruma_api! { #[ruma_api(header = LOCATION)] pub location: String, } + + error: crate::Error } diff --git a/src/r0/state/create_state_event_for_empty_key.rs b/src/r0/state/create_state_event_for_empty_key.rs index 935d473f..e0c0decb 100644 --- a/src/r0/state/create_state_event_for_empty_key.rs +++ b/src/r0/state/create_state_event_for_empty_key.rs @@ -31,4 +31,6 @@ ruma_api! { /// A unique identifier for the event. pub event_id: EventId, } + + error: crate::Error } diff --git a/src/r0/state/create_state_event_for_key.rs b/src/r0/state/create_state_event_for_key.rs index c77e9ad7..d377cb98 100644 --- a/src/r0/state/create_state_event_for_key.rs +++ b/src/r0/state/create_state_event_for_key.rs @@ -34,4 +34,6 @@ ruma_api! { /// A unique identifier for the event. pub event_id: EventId, } + + error: crate::Error } diff --git a/src/r0/state/get_state_events.rs b/src/r0/state/get_state_events.rs index 3b81e3d4..d45ddd43 100644 --- a/src/r0/state/get_state_events.rs +++ b/src/r0/state/get_state_events.rs @@ -28,4 +28,6 @@ ruma_api! { #[wrap_incoming(StateEvent with EventResult)] pub room_state: Vec, } + + error: crate::Error } diff --git a/src/r0/state/get_state_events_for_empty_key.rs b/src/r0/state/get_state_events_for_empty_key.rs index 88a0554d..ae8a3619 100644 --- a/src/r0/state/get_state_events_for_empty_key.rs +++ b/src/r0/state/get_state_events_for_empty_key.rs @@ -29,4 +29,6 @@ ruma_api! { #[ruma_api(body)] pub content: Value, } + + error: crate::Error } diff --git a/src/r0/state/get_state_events_for_key.rs b/src/r0/state/get_state_events_for_key.rs index 085b334c..815980b3 100644 --- a/src/r0/state/get_state_events_for_key.rs +++ b/src/r0/state/get_state_events_for_key.rs @@ -32,4 +32,6 @@ ruma_api! { #[ruma_api(body)] pub content: Value, } + + error: crate::Error } diff --git a/src/r0/sync/sync_events.rs b/src/r0/sync/sync_events.rs index 4eb454d1..dcf9c28a 100644 --- a/src/r0/sync/sync_events.rs +++ b/src/r0/sync/sync_events.rs @@ -66,6 +66,8 @@ ruma_api! { #[wrap_incoming] pub to_device: ToDevice, } + + error: crate::Error } /// Whether to set presence or not during sync. diff --git a/src/r0/tag/create_tag.rs b/src/r0/tag/create_tag.rs index 4aef78dc..e0337918 100644 --- a/src/r0/tag/create_tag.rs +++ b/src/r0/tag/create_tag.rs @@ -30,4 +30,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/tag/delete_tag.rs b/src/r0/tag/delete_tag.rs index ffe3adbe..633903d9 100644 --- a/src/r0/tag/delete_tag.rs +++ b/src/r0/tag/delete_tag.rs @@ -26,4 +26,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/tag/get_tags.rs b/src/r0/tag/get_tags.rs index a9448802..14e30112 100644 --- a/src/r0/tag/get_tags.rs +++ b/src/r0/tag/get_tags.rs @@ -28,4 +28,6 @@ ruma_api! { #[wrap_incoming(with EventResult)] pub tags: TagEventContent, } + + error: crate::Error } diff --git a/src/r0/thirdparty/get_location_for_protocol.rs b/src/r0/thirdparty/get_location_for_protocol.rs index 4ae94589..7cf5633c 100644 --- a/src/r0/thirdparty/get_location_for_protocol.rs +++ b/src/r0/thirdparty/get_location_for_protocol.rs @@ -31,4 +31,6 @@ ruma_api! { #[ruma_api(body)] pub locations: Vec, } + + error: crate::Error } diff --git a/src/r0/thirdparty/get_location_for_room_alias.rs b/src/r0/thirdparty/get_location_for_room_alias.rs index a9c8a4e2..b1038afc 100644 --- a/src/r0/thirdparty/get_location_for_room_alias.rs +++ b/src/r0/thirdparty/get_location_for_room_alias.rs @@ -26,4 +26,6 @@ ruma_api! { #[ruma_api(body)] pub locations: Vec, } + + error: crate::Error } diff --git a/src/r0/thirdparty/get_protocol.rs b/src/r0/thirdparty/get_protocol.rs index ea94b348..61cf67fb 100644 --- a/src/r0/thirdparty/get_protocol.rs +++ b/src/r0/thirdparty/get_protocol.rs @@ -25,4 +25,6 @@ ruma_api! { #[ruma_api(body)] pub protocol: Protocol, } + + error: crate::Error } diff --git a/src/r0/thirdparty/get_protocols.rs b/src/r0/thirdparty/get_protocols.rs index c17124e4..e563ab61 100644 --- a/src/r0/thirdparty/get_protocols.rs +++ b/src/r0/thirdparty/get_protocols.rs @@ -23,4 +23,6 @@ ruma_api! { #[ruma_api(body)] pub protocols: HashMap, } + + error: crate::Error } diff --git a/src/r0/thirdparty/get_user_for_protocol.rs b/src/r0/thirdparty/get_user_for_protocol.rs index 4f34e7dc..557f1232 100644 --- a/src/r0/thirdparty/get_user_for_protocol.rs +++ b/src/r0/thirdparty/get_user_for_protocol.rs @@ -31,4 +31,6 @@ ruma_api! { #[ruma_api(body)] pub users: Vec, } + + error: crate::Error } diff --git a/src/r0/thirdparty/get_user_for_user_id.rs b/src/r0/thirdparty/get_user_for_user_id.rs index 10653609..476f69c3 100644 --- a/src/r0/thirdparty/get_user_for_user_id.rs +++ b/src/r0/thirdparty/get_user_for_user_id.rs @@ -26,4 +26,6 @@ ruma_api! { #[ruma_api(body)] pub users: Vec, } + + error: crate::Error } diff --git a/src/r0/typing/create_typing_event.rs b/src/r0/typing/create_typing_event.rs index 3dad3ef2..d24dc82c 100644 --- a/src/r0/typing/create_typing_event.rs +++ b/src/r0/typing/create_typing_event.rs @@ -31,4 +31,6 @@ ruma_api! { } response {} + + error: crate::Error } diff --git a/src/r0/user_directory/search_users.rs b/src/r0/user_directory/search_users.rs index 403e3eed..a0b54cee 100644 --- a/src/r0/user_directory/search_users.rs +++ b/src/r0/user_directory/search_users.rs @@ -31,6 +31,8 @@ ruma_api! { /// Indicates if the result list has been truncated by the limit. pub limited: bool, } + + error: crate::Error } /// User data as result of a search. diff --git a/src/r0/voip/get_turn_server_info.rs b/src/r0/voip/get_turn_server_info.rs index 91ce8597..5e83b58f 100644 --- a/src/r0/voip/get_turn_server_info.rs +++ b/src/r0/voip/get_turn_server_info.rs @@ -27,4 +27,6 @@ ruma_api! { /// The username to use. pub username: String, } + + error: crate::Error } diff --git a/src/unversioned/discover_homeserver.rs b/src/unversioned/discover_homeserver.rs index 96b66769..3c3dd557 100644 --- a/src/unversioned/discover_homeserver.rs +++ b/src/unversioned/discover_homeserver.rs @@ -39,4 +39,6 @@ ruma_api! { #[serde(rename = "m.identity_server")] pub identity_server: Option, } + + error: crate::Error } diff --git a/src/unversioned/get_supported_versions.rs b/src/unversioned/get_supported_versions.rs index fdf98eb5..b8fc8308 100644 --- a/src/unversioned/get_supported_versions.rs +++ b/src/unversioned/get_supported_versions.rs @@ -23,4 +23,6 @@ ruma_api! { #[serde(default, skip_serializing_if = "HashMap::is_empty")] pub unstable_features: HashMap } + + error: crate::Error }