-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
P2Priority 2 - MediumPriority 2 - MediumdiagnosticsDiagnosticsDiagnosticsdxDeveloper experienceDeveloper experienceerror-handlingError handlingError handling
Milestone
Description
Improve Error Messages and Diagnostics
Priority
P2 (Medium) - Developer experience
Labels
dxerror-handlingdiagnosticsP2
Estimated Effort
2 weeks
Description
Create rich, helpful compiler diagnostics using the ariadne crate. Good error messages are critical for developer experience.
Current State
Location: core/src/report.rs
Error reporting module exists but has todo!() placeholder and is underutilized throughout the codebase.
TODO References
report.rs:53-todo!()
Examples of Good Error Messages
Current (Bad)
Error: Failed to compile schema
Desired (Good)
error: undefined type `Uesr`
┌─ example.ids:5:12
│
5 │ user: Uesr
│ ^^^^ not found in this scope
│
= help: did you mean `User`?
Acceptance Criteria
- Source location tracking throughout compilation
- Beautiful error messages with
ariadnefor:- Parse errors
- Semantic errors
- Type errors
- Import errors
- "Did you mean?" suggestions for typos
- Multiple errors shown (don't stop at first)
- Warning system for non-critical issues
- Documentation of common errors with solutions
Tasks
Infrastructure
- Add
Spantracking to all AST nodes - Thread source locations through compilation
- Create error types with location info
- Integrate
ariadnefor rendering
Error Categories
- Parse errors: syntax mistakes, invalid tokens
- Semantic errors: undefined symbols, duplicate names
- Type errors: type mismatches, invalid operations
- Import errors: missing files, circular imports
- Version errors: incompatible versions, breaking changes
Enhancements
- Add "did you mean?" for common typos (Levenshtein distance)
- Multi-error reporting (collect all errors, not just first)
- Warning levels (error, warning, note)
- Colored output (using
ariadne's auto-color feature) - JSON output mode for IDE integration
Documentation
- Document common errors with examples
- Create error code system (E001, E002, etc.)
- Add links to documentation in errors
Example Implementation
use ariadne::{Report, ReportKind, Label, Source};
Report::build(ReportKind::Error, source_id, span.start)
.with_message("undefined type")
.with_label(
Label::new((source_id, span))
.with_message("not found in this scope")
.with_color(Color::Red)
)
.with_help("did you mean `User`?")
.finish()
.print((source_id, Source::from(source_code)))Dependencies
- Consolidate and Complete IDL Parser #3 IR Compilation (errors occur during compilation)
Blocks
None
Metadata
Metadata
Assignees
Labels
P2Priority 2 - MediumPriority 2 - MediumdiagnosticsDiagnosticsDiagnosticsdxDeveloper experienceDeveloper experienceerror-handlingError handlingError handling
Type
Projects
Status
Todo