Create nice error messages full of context
My take on creating nice error messages intended for both libraries and end user code. With a high amount of possible ways of adding more context for end users. This project started in pdbtx and then moved with all my new Rust projects but now finally has ended up in its very own crate.
Features
- Supports rich context (file names, file numbers)
- Supports multiple highlights in a single context
ββ[file.txt:42]
42 β Hello world
β βΆββ΄βΆβ΄ββ
β΅
- Supports multiline contexts
- Supports comments on highlights
β·
β Hello world
β βΆβ΄
β Make it a good one!
β βΆβ΄Cool βΆββ΄1
β΅
- Supports adding suggestions to the error message
error: Invalid path
β·
β fileee.txt
β΅
This file does not exist
Did you mean any of: file.txt, filet.txt?
- Supports merging multiple instances of the same error
- Supports version tags in the error
error: Invalid number
β·
3 β null,80o0,YES,,67.77
β βΆβββ΄
13 β null,7oo1,NO,-1,23.11
β βΆβββ΄
35 β HOMOSAPIENS,12i1,YES,,1.23
β βΆβββ΄
β΅
This column is not a number
Version: Software AB v2025.42
- Supports displaying the output with colours (controlled with a feature)
- Supports displaying the output using only ascii characters (controlled with a feature)
- Supports displaying the output as HTML
And most importantly it allows you to only define those properties that are known and make sense and slims down the output to always be neat.
License
EUPL