Skip to content
Merged
Changes from all 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
14 changes: 11 additions & 3 deletions crates/swc_error_reporters/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,18 @@ impl ThreadSafetyDiagnostics {
skip_filename: bool,
color: ColorConfig,
) -> Vec<String> {
let handler = to_pretty_handler(color);
self.0
let diagnostics = self
.0
.lock()
.expect("Failed to access the diagnostics lock")
.expect("Failed to access the diagnostics lock");

// If there are no diagnostics, return empty vector without initializing handler
if diagnostics.is_empty() {
return Vec::new();
}

let handler = to_pretty_handler(color);
diagnostics
.iter()
.map(|d| d.to_pretty_string(cm, skip_filename, &handler))
.collect::<Vec<String>>()
Expand Down
Loading