wecom-agent 0.1.16

企业微信API的轻封装,让消息发送更加便捷。
Documentation
use std::error::Error as StdError;
use std::fmt;

#[derive(Debug, Clone)]
pub struct Error {
    code: i64,
    text: String,
}

impl Error {
    pub fn new(code: i64, text: String) -> Self {
        Self { code, text }
    }
}

impl fmt::Display for Error {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "Error code: {}, {}", self.code, self.text)
    }
}

impl StdError for Error {}