This repository has been archived on 2024-05-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)
}