Skip to content

Commit

Permalink
Slightly improve experimental.mdxRs error message with Webpack (#68356)
Browse files Browse the repository at this point in the history
This is of course still not great. Is there a way/will to have
codeframes similar to vercel/turborepo#8879 when
using Webpack?

Before:
```
Error: page.mdx:Error: Message { place: Some(Point(7:1 (87))), reason: "Unexpected end of file in expression, expected a corresponding closing brace for `{`", rule_id: "unexpected-eof", source: "markdown-rs" }

Import trace for requested module:
./app/blog/hello-world/page.mdx
 ⨯ ./app/blog/hello-world/page.mdx
```

After:
```
Error: page.mdx:Error: 7:1: Unexpected end of file in expression, expected a corresponding closing brace for `{` (markdown-rs:unexpected-eof)

Import trace for requested module:
./app/blog/hello-world/page.mdx
 ⨯ ./app/blog/hello-world/page.mdx
```
  • Loading branch information
mischnic authored Sep 24, 2024
1 parent f57cada commit d463b8b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/napi/src/mdx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ impl Task for MdxCompileTask {
let options: Options = serde_json::from_slice(&self.option)?;

compile(&self.input, &options)
.map_err(|err| napi::Error::new(Status::GenericFailure, format!("{:?}", err)))
.map_err(|err| napi::Error::new(Status::GenericFailure, err.to_string()))
}

fn resolve(&mut self, _env: Env, output: Self::Output) -> napi::Result<Self::JsValue> {
Expand Down

0 comments on commit d463b8b

Please sign in to comment.