feat(core): enhance error message for dev server request, closes #13816 (#14107)

This commit is contained in:
Lucas Fernandes Nogueira 2025-08-28 12:36:49 -03:00 committed by GitHub
parent f70b28529d
commit 07e134f70e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
"tauri": patch:enhance
---
Improve error message for request errors on iOS when local network permission has been denied and the app tries to reach the development server.

View File

@ -187,8 +187,20 @@ fn get_response<R: Runtime>(
.body(response.body.to_vec().into())?
}
Err(e) => {
log::error!("Failed to request {}: {}", url.as_str(), e);
return Err(Box::new(e));
let error_message = format!(
"Failed to request {}: {}{}",
url.as_str(),
e,
if let Some(s) = e.status() {
format!("status code: {}", s.as_u16())
} else if cfg!(target_os = "ios") {
", did you grant local network permissions? That is required to reach the development server. Please grant the permission via the prompt or in `Settings > Privacy & Security > Local Network` and restart the app. See https://support.apple.com/en-us/102229 for more information.".to_string()
} else {
"".to_string()
}
);
log::error!("{error_message}");
return Err(error_message.into());
}
}
};