Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(lsp): Print out stack trace if exception occurs in TS request #23543

Merged
merged 3 commits into from
Apr 24, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cli/lsp/tsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4258,6 +4258,20 @@ impl TscRuntime {

server_request_fn.call(tc_scope, undefined, &args);
if tc_scope.has_caught() && !tc_scope.has_terminated() {
if let Some(stack_trace) = tc_scope.stack_trace() {
lsp_warn!(
"Error during TS request \"{method}\":\n {}",
stack_trace.to_rust_string_lossy(tc_scope),
);
} else {
lsp_warn!(
"Error during TS request \"{method}\":\n {}",
tc_scope
.exception()
.map(|exc| exc.to_rust_string_lossy(tc_scope))
.unwrap_or_default(),
);
}
tc_scope.rethrow();
}
}
Expand All @@ -4276,6 +4290,8 @@ impl TscRuntime {
}
}

// fn print_exception(tc_scope: &mut v8::TryCatch<>)
nathanwhit marked this conversation as resolved.
Show resolved Hide resolved

fn run_tsc_thread(
mut request_rx: UnboundedReceiver<Request>,
performance: Arc<Performance>,
Expand Down
Loading