m/cup
1
0
mirror of https://github.com/sergi0g/cup.git synced 2025-11-08 13:13:49 -05:00

Forgot to handle another potential error

This commit is contained in:
Sergio
2024-08-31 21:44:31 +03:00
parent def2efa0d1
commit 7292ed3d1b

View File

@@ -17,6 +17,19 @@ pub fn check_auth(registry: &str, config: &JsonValue) -> Option<String> {
Some(challenge) => Some(parse_www_authenticate(challenge)),
None => error!("Unauthorized to access registry {} and no way to authenticate was provided", registry),
},
Err(Error::Transport(error)) => {
match error.kind() {
ErrorKind::Dns => {
warn!("Failed to lookup the IP of the registry, retrying.");
return check_auth(registry, config)
}, // If something goes really wrong, this can get stuck in a loop
ErrorKind::ConnectionFailed => {
warn!("Connection probably timed out, retrying.");
return check_auth(registry, config)
}, // Same here
_ => error!("{}", error)
}
},
Err(e) => error!("{}", e),
}
}