Skip to content

Commit 07e134f

Browse files
authored
feat(core): enhance error message for dev server request, closes #13816 (#14107)
1 parent f70b285 commit 07e134f

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch:enhance
3+
---
4+
5+
Improve error message for request errors on iOS when local network permission has been denied and the app tries to reach the development server.

crates/tauri/src/protocol/tauri.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,20 @@ fn get_response<R: Runtime>(
187187
.body(response.body.to_vec().into())?
188188
}
189189
Err(e) => {
190-
log::error!("Failed to request {}: {}", url.as_str(), e);
191-
return Err(Box::new(e));
190+
let error_message = format!(
191+
"Failed to request {}: {}{}",
192+
url.as_str(),
193+
e,
194+
if let Some(s) = e.status() {
195+
format!("status code: {}", s.as_u16())
196+
} else if cfg!(target_os = "ios") {
197+
", 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()
198+
} else {
199+
"".to_string()
200+
}
201+
);
202+
log::error!("{error_message}");
203+
return Err(error_message.into());
192204
}
193205
}
194206
};

0 commit comments

Comments
 (0)