summaryrefslogtreecommitdiff
path: root/cli/errors.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2021-06-11 09:03:42 -0400
committerGitHub <noreply@github.com>2021-06-11 09:03:42 -0400
commit1a92c39b77c46170a2135994359962034c8131c5 (patch)
tree8643d3b36820e3fb75a6bb0c797de2d8635f48af /cli/errors.rs
parent9d706d71b55ca254d1bbd87754533a60142d2a6a (diff)
refactor(ast): Change AST parsing error to return struct with message and location (#10911)
* Remove unused check js emit option. * Improve parse error. * Format.
Diffstat (limited to 'cli/errors.rs')
-rw-r--r--cli/errors.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/cli/errors.rs b/cli/errors.rs
index a1395fb61..0b2644b57 100644
--- a/cli/errors.rs
+++ b/cli/errors.rs
@@ -9,7 +9,7 @@
//! Diagnostics are compile-time type errors, whereas JsErrors are runtime
//! exceptions.
-use crate::ast::DiagnosticBuffer;
+use crate::ast::Diagnostic;
use crate::import_map::ImportMapError;
use deno_core::error::AnyError;
@@ -17,7 +17,7 @@ fn get_import_map_error_class(_: &ImportMapError) -> &'static str {
"URIError"
}
-fn get_diagnostic_class(_: &DiagnosticBuffer) -> &'static str {
+fn get_diagnostic_class(_: &Diagnostic) -> &'static str {
"SyntaxError"
}
@@ -27,10 +27,7 @@ pub(crate) fn get_error_class_name(e: &AnyError) -> &'static str {
e.downcast_ref::<ImportMapError>()
.map(get_import_map_error_class)
})
- .or_else(|| {
- e.downcast_ref::<DiagnosticBuffer>()
- .map(get_diagnostic_class)
- })
+ .or_else(|| e.downcast_ref::<Diagnostic>().map(get_diagnostic_class))
.unwrap_or_else(|| {
panic!(
"Error '{}' contains boxed error of unknown type:{}",