Archived
1
0
Fork 0
forked from Anri/cal8tor
This repository has been archived on 2023-04-23. You can view files and clone it, but cannot push or open issues or pull requests.
cal8tor/src/utils.rs

16 lines
400 B
Rust
Raw Normal View History

2022-08-16 15:48:13 +02:00
/// Panic if an error happened
pub fn check_errors(html: &String, loc: &str) {
match html {
t if t.contains(&err_code(429)) => panic!(
"URL: {} • HTTP 429: Slow down - Rate limited (too many access attempts detected)",
loc
),
_ => (),
}
}
/// Create String error code
fn err_code(code: i32) -> String {
format!("HTTP Code : {}", code)
}