summaryrefslogtreecommitdiff
path: root/cli/tools/fmt.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-09-27 01:44:36 +0100
committerGitHub <noreply@github.com>2024-09-26 20:44:36 -0400
commit09a7cc4723eab0cf80cb18897fa372faa9de5b03 (patch)
treeb360a8548987261a262383091245a60f46111634 /cli/tools/fmt.rs
parenteff64238b6c18ba3718c22c3b75a4618412c39e5 (diff)
refactor(fmt): rewrite HTML syntax error handling (#25892)
Diffstat (limited to 'cli/tools/fmt.rs')
-rw-r--r--cli/tools/fmt.rs12
1 files changed, 1 insertions, 11 deletions
diff --git a/cli/tools/fmt.rs b/cli/tools/fmt.rs
index a7f4fd554..8a4bc4e6c 100644
--- a/cli/tools/fmt.rs
+++ b/cli/tools/fmt.rs
@@ -437,25 +437,15 @@ pub fn format_html(
)
.map_err(|error| match error {
markup_fmt::FormatError::Syntax(error) => {
- // TODO(bartlomieju): rework when better error support in `markup_fmt` lands
fn inner(
error: &markup_fmt::SyntaxError,
file_path: &Path,
) -> Option<String> {
- let error_str = format!("{}", error);
- let error_str = error_str.strip_prefix("syntax error '")?;
-
- let reason = error_str
- .split("' at")
- .collect::<Vec<_>>()
- .first()
- .map(|s| s.to_string())?;
-
let url = Url::from_file_path(file_path).ok()?;
let error_msg = format!(
"Syntax error ({}) at {}:{}:{}\n",
- reason,
+ error.kind,
url.as_str(),
error.line,
error.column