forgejo-contrib-forgejo-cli-pulls-466.md
Watch20
Star402
Fork
You've already forked forgejo-cli
CodeIssues 44Pull requests 8Releases 11Packages 2WikiActivity
Open
SLASHLogin wants to merge 3 commits from slashlogin/error-printing into main AGit
pull from: slashlogin/error-printing
merge into: forgejo-contrib:main
forgejo-contrib:main
forgejo-contrib:renovate/lock-file-maintenance
forgejo-contrib:renovate/serde-saphyr-0.x
forgejo-contrib:docs/contributing
forgejo-contrib:no-port-in-refspec
forgejo-contrib:login/v16.next.forgejo.org
forgejo-contrib:crates-io-publish
forgejo-contrib:0.5.x
forgejo-contrib:compile-time-fluent
forgejo-contrib:0.4.x
forgejo-contrib:localization-alias-demo
forgejo-contrib:api_url_field
Conversation 3Commits 3Files changed 7 +360 -21
SLASHLogin commented 2026-05-18 21:37:03 +02:00
First-time contributor
Copy link
Solves forgejo-contrib/forgejo-cli#112. Adds opinionated Handler for printing and formatting errors.
Feel free to suggest different formatting of reporting.
Solves forgejo-contrib/forgejo-cli#112. Adds opinionated Handler for printing and formatting errors. Feel free to suggest different formatting of reporting.
SLASHLogin changed title from ** feat: init error handler - change theme ** to WIP: Better error printing 2026-05-18 21:37:28 +02:00
SLASHLogin force-pushed slashlogin/error-printing from 373c4efd9c
Some checks failed
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline failed
to 0064ece1ff
All checks were successful
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline was successful
2026-05-18 21:42:09 +02:00 Compare
SLASHLogin force-pushed slashlogin/error-printing from 0064ece1ff
All checks were successful
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline was successful
to 6cc8042c81
Some checks failed
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline failed
2026-05-30 16:16:45 +02:00 Compare
SLASHLogin force-pushed slashlogin/error-printing from 6cc8042c81
Some checks failed
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline failed
to e39e160d79
All checks were successful
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline was successful
2026-05-30 16:20:06 +02:00 Compare
SLASHLogin added 1 commit 2026-05-30 16:33:56 +02:00
docs: move doc to handler, to explain the expected output of errors
All checks were successful
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline was successful
[ a8fee32118
](/forgejo-contrib/forgejo-cli/pulls/466/commits/a8fee32118bfea89b662e550b8c8c7510a01a90d)
SLASHLogin commented 2026-05-30 16:42:01 +02:00
Author
First-time contributor
Copy link
I think this can be considered finished. Added alerting reporting inspired by eyre-color does it. I've ended up not using their crate as it wasn't really what I imagined + it may be wished to extend the handler in the future anyway, so I'd rather not box it into already existing Handler.
Stylistically I was trying to not stray away too much from the already existing clis: jj, uv, ruff, ty, cargo, rustup.
But if you have other preference please let me know.
I've used fj repo view for example - below you can find screenshots:
I think this can be considered finished. Added alerting reporting inspired by eyre-color does it. I've ended up not using their crate as it wasn't really what I imagined + it may be wished to extend the handler in the future anyway, so I'd rather not box it into already existing Handler. Stylistically I was trying to not stray away too much from the already existing clis: jj, uv, ruff, ty, cargo, rustup. But if you have other preference please let me know. I've used fj repo view for example - below you can find screenshots:
[image.png](https://codeberg.org/attachments/1c6d1a8d-e635-41b6-8bd4-5ef3199797ab "Click to see "image.png" in a new tab")
19 KiB
[image.png](https://codeberg.org/attachments/eb57383f-ec9c-4e03-9dd1-39a0a01dd147 "Click to see "image.png" in a new tab")
17 KiB
[image.png](https://codeberg.org/attachments/a16aecc6-5c0b-4527-8534-87e749aecc3b "Click to see "image.png" in a new tab")
24 KiB
[image.png](https://codeberg.org/attachments/61ad04cc-847f-4f69-98e2-b911f135ac26 "Click to see "image.png" in a new tab")
94 KiB
SLASHLogin changed title from ** WIP: Better error printing ** to Better error printing 2026-05-30 16:42:06 +02:00
SLASHLogin commented 2026-05-30 16:43:36 +02:00
Author
First-time contributor
Copy link
Should also add that the one example I've edited now uses new translations, mainly to support Section, so the other already existing translations may need an update. Let me know if you want fixes for other languages in this PR or separate one.
Should also add that the one example I've edited now uses new translations, mainly to support Section, so the other already existing translations may need an update. Let me know if you want fixes for other languages in this PR or separate one.
Fluffinity reviewed 2026-06-23 13:21:03 +02:00
| | | | @ -0,0 +23,4 @@ |
| | | | | /// error: <message> bright red + bold |
| | | | | /// caused by: <source> cyan, one per cause in the chain |
| | | | | /// suggestion: <text> bright blue, one per .suggestion(..) |
| | | | | /// note: <text> bright green, one per .note(..) |
Fluffinity commented 2026-06-23 13:21:03 +02:00
Contributor
Copy link
Maybe use green for suggestions instead. They are supposed to present possible fixes, which green more typically indicates and it increases the contrast between causes and suggestions. It's easy to mistake blue for cyan and vice-versa, increasing the effort required to scan the output.
Maybe use green for suggestions instead. They are supposed to present possible fixes, which green more typically indicates and it increases the contrast between causes and suggestions. It's easy to mistake blue for cyan and vice-versa, increasing the effort required to scan the output.
Fluffinity commented 2026-06-23 13:29:05 +02:00
Contributor
Copy link
Also, notes are currently unused. So I suggest finding spots for useful notes to attach to errors or to remove them. If we do use them, maybe light grey would be a better color for them, as they are supposed to be additional information, that is typically not required. Using a color like light grey for this purpose better signals that intent.
Also, notes are currently unused. So I suggest finding spots for useful notes to attach to errors or to remove them. If we do use them, maybe light grey would be a better color for them, as they are supposed to be additional information, that is typically not required. Using a color like light grey for this purpose better signals that intent.
Fluffinity reviewed 2026-06-23 13:39:36 +02:00
| | | | @ -0,0 +42,4 @@ |
| | | | | impl Handler { |
| | | | | fn new() -> Self { |
| | | | | //Backtrace::capturealready respectsRUST_BACKTRACE/RUST_LIB_BACKTRACE. |
| | | | | let backtrace = Backtrace::capture(); |
Fluffinity commented 2026-06-23 13:39:36 +02:00
Contributor
Copy link
That's very neat! Makes debugging a lot easier.
That's very neat! Makes debugging a lot easier.
Fluffinity requested changes 2026-06-23 13:48:47 +02:00
Fluffinity left a comment
Copy link
The current backtrace handling here makes things more complicated, than they need to be. The backtrace with its status already acts as an effective Option on the real backtrace.
The current backtrace handling here makes things more complicated, than they need to be. The backtrace with its status already acts as an effective Option on the real backtrace.
| | | | @ -0,0 +36,4 @@ |
| | | | | ///true= user mistake: show suggestions, hide the "please report" line. |
| | | | | ///false= internal/unexpected error (the default). |
| | | | | expected: bool, |
| | | | | backtrace: Option<Backtrace>, |
Fluffinity commented 2026-06-23 13:43:41 +02:00
Contributor
Copy link
This would then become a plain Backtrace
This would then become a plain Backtrace
| | | | @ -0,0 +47,4 @@ |
| | | | | suggestions: Vec::new(), |
| | | | | notes: Vec::new(), |
| | | | | expected: false, |
| | | | | backtrace: (backtrace.status() == BacktraceStatus::Captured).then_some(backtrace), |
Fluffinity commented 2026-06-23 13:43:21 +02:00
Contributor
Copy link
We can keep this simpler by always passing the generated backtrace struct into the handler.
We can keep this simpler by always passing the generated backtrace struct into the handler.
| | | | @ -0,0 +94,4 @@ |
| | | | | } |
| | | | | |
| | | | | // IF backtrace enabled: backtrace-colored |
| | | | | if let Some(backtrace) = &self.backtrace { |
Fluffinity commented 2026-06-23 13:45:39 +02:00
Contributor
Copy link
Just put the check for the BacktraceStatus here. No need to wrap the entire thing in an Option if the struct itself is effectively an Option<ActualBacktrace> already.
Just put the check for the BacktraceStatus here. No need to wrap the entire thing in an Option if the struct itself is effectively an Option\<ActualBacktrace\> already.
Fluffinity referenced this pull request 2026-06-24 11:36:17 +02:00 chore: optimize cargo release profile #520
All checks were successful Hide all checks
ci/woodpecker/pr/check-typos Pipeline was successful
ci/woodpecker/pr/check Pipeline was successful
Required Details
This pull request has changes conflicting with the target branch.
Use this merge commit message when completing the merge manually.
Merge commit titleMerge pull request 'Better error printing' (#466) from slashlogin/error-printing into main
Merge commit bodyReviewed-on: https://codeberg.org/forgejo-contrib/forgejo-cli/pulls/466 Merge pull request 'Better error printing' (#466) from slashlogin/error-printing into main Reviewed-on: https://codeberg.org/forgejo-contrib/forgejo-cli/pulls/466 Copy merge commit message
From your project repository, check out a new branch and test the changes.
git fetch -u origin +refs/pull/466/head:slashlogin/error-printing
git switch slashlogin/error-printing
Sign in to join this conversation.
Reviewers
No reviewers
Labels
Clear labels[ Kind/Breaking Breaking change that won't be backward compatible
](#)[ Kind/Bug Something is not working
](#)[ Kind/Design Discussion about UI/UX design
](#)[ Kind/Documentation Documentation changes
](#)[ Kind/Enhancement Improve existing functionality
](#)[ Kind/Feature New functionality
](#)[ Kind/Security This is security issue
](#)[ Kind/Testing Issue or pull request related to testing
](#)[ Kind/Upstream This is an issue with upstream software (Forgejo) that is probably not our fault
](#)
[ Priority
Critical The priority is critical
](#)[ Priority
High The priority is high
](#)[ Priority
Low The priority is low
](#)[ Priority
Medium The priority is medium
](#)
[ Reviewed
Confirmed Issue has been confirmed
](#)[ Reviewed
Duplicate This issue or pull request already exists
](#)[ Reviewed
Invalid Invalid issue
](#)[ Reviewed
Won't Fix This issue won't be fixed
](#)
[ Status
Abandoned Somebody has started to work on this but abandoned work
](#)[ Status
Blocked Something is blocking this issue or pull request
](#)[ Status
Need More Info Feedback is required to reproduce issue or to continue work
](#)
[ Suspicious
](#)
No labels Kind/Breaking Kind/Bug Kind/Design Kind/Documentation Kind/Enhancement Kind/Feature Kind/Security Kind/Testing Kind/Upstream [ Priority
Critical ](/forgejo-contrib/forgejo-cli/pulls?labels=173012) [ Priority
High ](/forgejo-contrib/forgejo-cli/pulls?labels=173013) [ Priority
Low ](/forgejo-contrib/forgejo-cli/pulls?labels=173015) [ Priority
Medium ](/forgejo-contrib/forgejo-cli/pulls?labels=173014) [ Reviewed
Confirmed ](/forgejo-contrib/forgejo-cli/pulls?labels=173007) [ Reviewed
Duplicate ](/forgejo-contrib/forgejo-cli/pulls?labels=173005) [ Reviewed
Invalid ](/forgejo-contrib/forgejo-cli/pulls?labels=173006) [ Reviewed
Won't Fix ](/forgejo-contrib/forgejo-cli/pulls?labels=173008) [ Status
Abandoned ](/forgejo-contrib/forgejo-cli/pulls?labels=173011) [ Status
Blocked ](/forgejo-contrib/forgejo-cli/pulls?labels=173010) [ Status
Need More Info ](/forgejo-contrib/forgejo-cli/pulls?labels=173009) Suspicious
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
Notifications Subscribe
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
forgejo-contrib/forgejo-cli!466
WritePreview
Loading…
Add table
| Rows | | | Columns | |
CancelOK
Add a link
Url Description Hint: With a URL in your clipboard, you can paste directly into the editor to create a link.
CancelOK
CancelSave
Reference in a new issue
Repository
forgejo-contrib/forgejo-cli
Title
Body
Create issue
No description provided.
Delete branch "slashlogin/error-printing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
No Yes