summaryrefslogtreecommitdiff
path: root/src/main.rs
Commit message (Collapse)AuthorAge
* Print source chains for errors.Owen Jacobson2025-11-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an error is printed, if that error has a source, print the source. Then repeat that process until there are no more sources. For an error with no source: the error message For an error with a single source: the error message caused by: the source's error message For an error message with chained sources: the error message caused by: the immediate source's error message the first transitive source's error message the second transitive source's error message … the ultimate source's error message That is, sources are printed from the outermost inwards, terminating with the lowest-level source. This printing occurs in two places: when pilcrow starts, and whenever it processes an internal server error. For internal server errors, the error message is prefixed with the error ID, as before, to allow operators to correlate log messages with responses if they choose to do so: [E1234] the error message caused by: the immediate source's error message the first transitive source's error message the second transitive source's error message … the ultimate source's error message Both call sites lock stderr to try to prevent interleaving messages. No promises about how well it works. I've not made any effort to ensure that multi-line error messages are correctly indented. So far as I know, pilcrow never emits a multi-line error message (except for long messages which are wrapped), so this likely isn't necessary. It's also surprisingly hard to do well, though there is [a crate for it][indenter]. [indenter]: https://docs.rs/indenter/latest/indenter/ There's a widespread convention for unix tools to prefix stderr output with the name of the program. For example, cat on my system prints the following when asked to open a nonexistent file: cat: nope: No such file or directory I've opted not to do that for Pilcrow. By my understanding, that convention is intended to help users identify which of several programs emitted a message when several programs share a stderr channel, for example when a program is used as part of a shell pipeline. Programs that are largely intended to be freestanding do not consistently follow the same convention - Cargo, clang, and gcc all write diagnostics to stderr with no prefix, for example. Pilcrow is, similarly, meant to be run in isolation, either as the single thing a user is running interactively, or because it's being run as a service. In either case, the prefix is not necessary to identify Pilcrow as the source of a message. I debated making the new `Exit` type crate-private, and having `cli::Args::run` return `impl Termination` to handle the interface between the crate and the outside world. For now, I've opted to instead return a result, so that any ill-advised callers trying to use Pilcrow as a library can at least attempt to understand the structure of its return value; this entails making `Exit` public as well, so that the CLI entry point (`main.rs`) can import it. This is an enabling change, with little immediate impact on its own. It probably makes some error messages print less than perfectly, but Pilcrow generates errors so rarely in development that it's hard to check. I'll be revising individual errors in later
* Automatically reorder imports to my preferred style.Owen Jacobson2025-08-30
|
* Remove `pilcrow::cli::Error` from the lib crate's public interface.Owen Jacobson2025-07-22
| | | | This might be the pettiest rude change I've ever made to a Rust program. If I saw this - or did this - in code _intend_ to be used as a library, I'd be appalled.
* Rename the project to `pilcrow`.Owen Jacobson2024-11-08
|
* Remove `hi-recanonicalize`.Owen Jacobson2024-10-30
| | | | This utility was needed to support a database migration with existing data. I have it on good authority that no further databases exist that are in the state that made this tool necessary.
* Provide `hi-recanonicalize` to recover from canonicalized-name problems.Owen Jacobson2024-10-22
|
* rustdoc comment for the (very limited) public API of the crate.Owen Jacobson2024-09-25
| | | | | | | | This silences some `-Wclippy::pedantic` warning, and it's just a good thing to do. I've made the choice to have the docs comment face programmers, and to provide `hi --help` and `hi -h` content via Clap attributes instead of inferring it from the docs comment. Internal (private) "rustdoc" comments have been converted to regular comments until I learn how to write better rustdoc.
* Store state in sqlite. Default to .hi in the cwd.Owen Jacobson2024-08-30
|
* Make it an HTTP serverOwen Jacobson2024-08-30
|
* Empty bin crateOwen Jacobson2024-08-30