Mention edit code in prints

This commit is contained in:
ItsDrike 2024-04-18 22:27:29 +02:00
parent d5dd28b4e5
commit 6bf9740839
Signed by: ItsDrike
GPG key ID: FA2745890B7048C0

View file

@ -89,43 +89,43 @@ fn main() {
while let Some(edit_code) = edit_codes.next() {
match edit_paste(&client, &csrf_data, &edit_code, PASTE_NAME) {
Ok(_) => {
println!("Success, found edit code: {edit_code}");
println!("Success, found edit code: {edit_code:?}");
return;
}
Err(e) => match e {
EditError::FormFieldError(msg) if msg == "Invalid edit code." => {
println!("Invalid edit code {edit_code}");
println!("Invalid edit code {edit_code:?}");
}
EditError::FormFieldError(msg) => {
eprintln!("Form error: {msg}");
eprintln!("Form error for code {edit_code:?}: {msg}");
return;
}
EditError::FormError(msg)
if msg == "You have hit the limit, please wait a bit. e345" =>
{
println!("Hit the limit, waiting...");
println!("Hit rate limit, waiting...");
csrf_data = CSRFData::get(&client, PASTE_NAME);
std::thread::sleep(std::time::Duration::from_secs(30));
edit_codes.retry_last().unwrap();
}
EditError::FormError(msg) => {
eprintln!("Form error: {msg}");
eprintln!("Form error for code {edit_code:?}: {msg}");
return;
}
EditError::RequestFailure(msg) => {
eprintln!("Request error (non 2XX): {msg}");
eprintln!("Request error (non 2XX) for code {edit_code:?}: {msg}");
return;
}
EditError::UnexpectedRedirect(msg) => {
eprintln!("Unexpected redirect: {msg}");
eprintln!("Unexpected redirect for code {edit_code:?}: {msg}");
return;
}
EditError::UnknownFailure(msg) => {
eprintln!("Unknown failure: {msg}");
eprintln!("Unknown failure for code {edit_code:?}: {msg}");
return;
}
EditError::ReqwestError(e) => {
eprintln!("Request failed with: {e:?}");
eprintln!("Request failed for code {edit_code:?} with: {e:?}");
return;
}
},