← Back to issue list

CraftError messages with new lines render inconsistently

View original Github issue

Metadata

Project
craft-cli
Number
#269
Type
issue
State
open
Author
mr-cal
Labels
Created
2024-08-27 21:44:03+00:00
Updated
2025-03-10 18:58:51+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

### Bug Description If the `message` field in a `CraftError` contains a new line, craft-cli appears to append whitespace, which causes the appearance of a new line between the `message` and `resolution` sections. Note that I cannot use the `details` field because `details` isn't visible at the default `brief` verbosity level. ### To Reproduce ```diff diff --git a/examples.py b/examples.py index c842a1a..c7fe76e 100755 --- a/examples.py +++ b/examples.py def example_10(): @@ -513,6 +516,15 @@ def example_30(): time.sleep(0.001) +def example_31(): + """Show an error.""" + path = "/dev/null" + raise CraftError( + message="Remote build does not support building multiple snaps on the same architecture:\n - Building on 'amd64' will create snaps for 'amd64' and 'riscv64'.", + resolution="this is the resolution", + ) + + # -- end of test cases if len(sys.argv) < 2: ``` ### part yaml _No response_ ### Relevant log output See the attached pictures. The same photo is highlighted to show what appears to be extraneous whitespace. ![Screenshot_20240827_164350](https://github.com/user-attachments/assets/0d4690da-28b6-48c5-91d0-fd642bde3a7b) ![Screenshot_20240827_164359](https://github.com/user-attachments/assets/902c95ea-caf6-442f-a487-d5aea5497eaf)

Evaluation history

No evaluation history available.