clickatell_api/one_api/send_messages/gateway_error.rs
1use crate::one_api::send_messages::GatewayErrorCode;
2use serde::Deserialize;
3
4/// If a [Request][crate::one_api::send_messages::Request] or [Message][crate::one_api::send_messages::Message] is not accepted by the gateway
5/// this will be returned in the corresponding [Response][crate::one_api::send_messages::Response] or [MessageResponse][crate::one_api::send_messages::Response].
6#[derive(Deserialize, Clone, Debug, PartialEq)]
7pub struct GatewayError {
8 /// Error code returned by One API
9 pub code: GatewayErrorCode,
10 /// Description of the error
11 pub description: String,
12}
13
14impl std::fmt::Display for GatewayError {
15 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::result::Result<(), std::fmt::Error> {
16 write!(f, "{} ({})", self.description, self.code)
17 }
18}