saas-rs-sdk 0.6.4

The SaaS RS SDK
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::payments::Error;
use stripe::StripeError;

impl From<StripeError> for Error {
    fn from(e: StripeError) -> Self {
        match e {
            StripeError::Stripe(ref e2, _code) => {
                let message = match e2.message {
                    Some(ref message) => message.clone(),
                    None => e.to_string(),
                };
                Error::internal(message)
            }
            StripeError::Timeout => Error::internal("Timeout communicating with Stripe".to_string()),
            _ => Error::internal(e.to_string()),
        }
    }
}