surface non-onboarding; do not retry non-onboarded requests

This commit is contained in:
Brandon Thomas committed 2025-05-12 17:00:25 -04:00
1 parent e3abd500db
commit fdc27b6ccd
2 files changed
+12 -1

No files matched your search

@@ -31,6 +31,9 @@ pub async fn image_upload_from_file_with_session_auto_renew<P: AsRef<Path>>(
let err = match result {
Ok(response) => return Ok((response, None)),
// We can't retry some errors.
Err(err @ SoraError::SoraUsernameNotYetCreated) => return Err(err),
// Retry all other errors.
Err(err) => err,
};
@@ -40,7 +40,15 @@ Message: {
|| message.contains("token_expired");
if cookie_expired {
return SoraError::UnauthorizedCookieOrBearerExpired
return SoraError::UnauthorizedCookieOrBearerExpired;
}
let needs_onboarding =
message.contains("You must onboard before using this service")
|| message.contains("onboarding_required");
if needs_onboarding {
return SoraError::SoraUsernameNotYetCreated;
}
let status_code = status.as_u16();