Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance(errors): Integrate miette for enhanced diagnostic reporting #10241

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

GiveMe-A-Name
Copy link
Contributor

@GiveMe-A-Name GiveMe-A-Name commented Mar 21, 2025

Description:

  • Added miette as a dependency for improved error handling and reporting.
  • Updated diagnostic handling to utilize miette for pretty printing errors.
  • Introduced a new DiagnosticCollection to manage and store diagnostics.
  • Refactored emitters to support the new diagnostic structure and ensure compatibility with miette.
  • Enhanced error handling in various components to provide clearer and more informative error messages.

BREAKING CHANGE:

The Rust api try_with_handler would occur break change.

- pub fn try_with_handler<F, Ret>(cm: Lrc<SourceMap>, config: HandlerOpts, op: F) -> Result<Ret, anyhow::Error>;
+ pub fn try_with_handler<F, Ret>(cm: Lrc<SourceMap>, config: HandlerOpts, op: F) -> Result<Ret, Vec<swc_common::Diagnostic>>;

Related issue (if exists):

#10192

- Added `miette` as a dependency for improved error handling and reporting.
- Updated diagnostic handling to utilize `miette` for pretty printing errors.
- Introduced a new `DiagnosticCollection` to manage and store diagnostics.
- Refactored emitters to support the new diagnostic structure and ensure compatibility with `miette`.
- Enhanced error handling in various components to provide clearer and more informative error messages.
@GiveMe-A-Name GiveMe-A-Name requested review from a team as code owners March 21, 2025 08:32
@GiveMe-A-Name GiveMe-A-Name marked this pull request as draft March 21, 2025 08:32
Copy link

changeset-bot bot commented Mar 21, 2025

⚠️ No Changeset found

Latest commit: cea273b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

codspeed-hq bot commented Mar 21, 2025

CodSpeed Performance Report

Merging #10241 will degrade performances by 1.05%

Comparing GiveMe-A-Name:enhance/improve-error-recovery (cea273b) with main (69788d7)

Summary

⚡ 1 improvements
❌ 1 regressions
✅ 150 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
serialization of serde 2.8 µs 2.8 µs -1.05%
es/lints/libs/terser 29.6 ms 29 ms +1.88%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant