Show KCL backtraces (#7033)
* Add backtrace to errors * Add display of backtraces with hints * Change pane badge to only show count of errors * Fix property name to not collide with Error superclass * Increase min stack again * Add e2e test that checks that the diagnostics are created in CodeMirror * Remove unneeded code * Change to the new hotness
This commit is contained in:
@ -28,19 +28,19 @@ impl Default for FileManager {
|
||||
impl FileSystem for FileManager {
|
||||
async fn read(&self, path: &TypedPath, source_range: SourceRange) -> Result<Vec<u8>, KclError> {
|
||||
tokio::fs::read(&path.0).await.map_err(|e| {
|
||||
KclError::Io(KclErrorDetails {
|
||||
message: format!("Failed to read file `{}`: {}", path.display(), e),
|
||||
source_ranges: vec![source_range],
|
||||
})
|
||||
KclError::Io(KclErrorDetails::new(
|
||||
format!("Failed to read file `{}`: {}", path.display(), e),
|
||||
vec![source_range],
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
async fn read_to_string(&self, path: &TypedPath, source_range: SourceRange) -> Result<String, KclError> {
|
||||
tokio::fs::read_to_string(&path.0).await.map_err(|e| {
|
||||
KclError::Io(KclErrorDetails {
|
||||
message: format!("Failed to read file `{}`: {}", path.display(), e),
|
||||
source_ranges: vec![source_range],
|
||||
})
|
||||
KclError::Io(KclErrorDetails::new(
|
||||
format!("Failed to read file `{}`: {}", path.display(), e),
|
||||
vec![source_range],
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
@ -49,10 +49,10 @@ impl FileSystem for FileManager {
|
||||
if e.kind() == std::io::ErrorKind::NotFound {
|
||||
Ok(false)
|
||||
} else {
|
||||
Err(KclError::Io(KclErrorDetails {
|
||||
message: format!("Failed to check if file `{}` exists: {}", path.display(), e),
|
||||
source_ranges: vec![source_range],
|
||||
}))
|
||||
Err(KclError::Io(KclErrorDetails::new(
|
||||
format!("Failed to check if file `{}` exists: {}", path.display(), e),
|
||||
vec![source_range],
|
||||
)))
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -71,10 +71,10 @@ impl FileSystem for FileManager {
|
||||
}
|
||||
|
||||
let mut read_dir = tokio::fs::read_dir(&path).await.map_err(|e| {
|
||||
KclError::Io(KclErrorDetails {
|
||||
message: format!("Failed to read directory `{}`: {}", path.display(), e),
|
||||
source_ranges: vec![source_range],
|
||||
})
|
||||
KclError::Io(KclErrorDetails::new(
|
||||
format!("Failed to read directory `{}`: {}", path.display(), e),
|
||||
vec![source_range],
|
||||
))
|
||||
})?;
|
||||
|
||||
while let Ok(Some(entry)) = read_dir.next_entry().await {
|
||||
|
Reference in New Issue
Block a user