Rework extension-related errors (#34620)

Before:
<img width="1728" height="1079" alt="before"
src="https://github.com/user-attachments/assets/4ab19211-8de4-458d-a835-52de859b7b20"
/>

After:
<img width="1728" height="1079" alt="after"
src="https://github.com/user-attachments/assets/231c9362-a0b0-47ae-b92e-de6742781d36"
/>

Makes clear which path is causing the FS error and removes backtraces
from logging.

Release Notes:

- N/A
This commit is contained in:
Kirill Bulatov 2025-07-17 15:20:47 +03:00 committed by GitHub
parent 4df7f52bf3
commit ceab139f54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 17 deletions

View file

@ -1313,11 +1313,18 @@ impl ExtensionStore {
} }
for snippets_path in &snippets_to_add { for snippets_path in &snippets_to_add {
if let Some(snippets_contents) = fs.load(snippets_path).await.log_err() { match fs
.load(snippets_path)
.await
.with_context(|| format!("Loading snippets from {snippets_path:?}"))
{
Ok(snippets_contents) => {
proxy proxy
.register_snippet(snippets_path, &snippets_contents) .register_snippet(snippets_path, &snippets_contents)
.log_err(); .log_err();
} }
Err(e) => log::error!("Cannot load snippets: {e:#}"),
}
} }
} }
}) })
@ -1331,22 +1338,27 @@ impl ExtensionStore {
let extension_path = root_dir.join(extension.manifest.id.as_ref()); let extension_path = root_dir.join(extension.manifest.id.as_ref());
let wasm_extension = WasmExtension::load( let wasm_extension = WasmExtension::load(
extension_path, &extension_path,
&extension.manifest, &extension.manifest,
wasm_host.clone(), wasm_host.clone(),
&cx, &cx,
) )
.await; .await
.with_context(|| format!("Loading extension from {extension_path:?}"));
if let Some(wasm_extension) = wasm_extension.log_err() { match wasm_extension {
wasm_extensions.push((extension.manifest.clone(), wasm_extension)); Ok(wasm_extension) => {
} else { wasm_extensions.push((extension.manifest.clone(), wasm_extension))
}
Err(e) => {
log::error!("Failed to load extension: {e:#}");
this.update(cx, |_, cx| { this.update(cx, |_, cx| {
cx.emit(Event::ExtensionFailedToLoad(extension.manifest.id.clone())) cx.emit(Event::ExtensionFailedToLoad(extension.manifest.id.clone()))
}) })
.ok(); .ok();
} }
} }
}
this.update(cx, |this, cx| { this.update(cx, |this, cx| {
this.reload_complete_senders.clear(); this.reload_complete_senders.clear();

View file

@ -173,9 +173,8 @@ impl HeadlessExtensionStore {
return Ok(()); return Ok(());
} }
let wasm_extension: Arc<dyn Extension> = Arc::new( let wasm_extension: Arc<dyn Extension> =
WasmExtension::load(extension_dir.clone(), &manifest, wasm_host.clone(), &cx).await?, Arc::new(WasmExtension::load(&extension_dir, &manifest, wasm_host.clone(), &cx).await?);
);
for (language_server_id, language_server_config) in &manifest.language_servers { for (language_server_id, language_server_config) in &manifest.language_servers {
for language in language_server_config.languages() { for language in language_server_config.languages() {

View file

@ -715,7 +715,7 @@ fn parse_wasm_extension_version_custom_section(data: &[u8]) -> Option<SemanticVe
impl WasmExtension { impl WasmExtension {
pub async fn load( pub async fn load(
extension_dir: PathBuf, extension_dir: &Path,
manifest: &Arc<ExtensionManifest>, manifest: &Arc<ExtensionManifest>,
wasm_host: Arc<WasmHost>, wasm_host: Arc<WasmHost>,
cx: &AsyncApp, cx: &AsyncApp,