canonical / snapcraft

Package, distribute, and update any app for Linux and IoT.
https://snapcraft.io
GNU General Public License v3.0
1.18k stars 445 forks source link

bug: "snapcraft register foo" prints unfriendly error #4930

Closed popey closed 1 month ago

popey commented 3 months ago

Bug Description

I want to register a snap. So I run snapcraft register foo. Snapcraft prints some boilerplate, asks for confirmation and then contacts the store, then prints an internal error full of \n and a couple of URLs. This could be a lot prettier.

To Reproduce

snapcraft register example-$(date +%Y%m%d)

Environment

$ snapcraft --version
snapcraft 8.3.1
$  lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04 LTS
Release:        24.04
Codename:       noble

snapcraft.yaml

N/A

Relevant log output

 snapcraft register example-$(date +%Y%m%d)
We always want to ensure that users get the software they expect
for a particular name.

If needed, we will rename snaps to ensure that a particular name
reflects the software most widely expected by our community.

For example, most people would expect 'thunderbird' to be published by
Mozilla. They would also expect to be able to get other snaps of
Thunderbird as '$username-thunderbird'.

Would you say that MOST users will expect 'example-20240719' to come from
you, and be the software you intend to publish there? [y/N]: y
snapcraft internal error: StoreServerError('Store operation failed:\n- name-review-required: All snap names are currently subject to a review. Please see https://forum.snapcraft.io/t/manual-review-of-all-new-snap-name-registrations/39440 for details.\nFollow this link to submit a name request for your snap: https://dashboard.snapcraft.io/register-snap')
Full execution log: '/home/alan/.local/state/snapcraft/log/snapcraft-20240719-215118.776921.log'

Additional context

Perhaps just printing the return from the store as a section might look nicer.

$ snapcraft register example-$(date +%Y%m%d)
We always want to ensure that users get the software they expect
for a particular name.

If needed, we will rename snaps to ensure that a particular name
reflects the software most widely expected by our community.

For example, most people would expect 'thunderbird' to be published by
Mozilla. They would also expect to be able to get other snaps of
Thunderbird as '$username-thunderbird'.

Would you say that MOST users will expect 'example-20240719' to come from
you, and be the software you intend to publish there? [y/N]: y

Store error:
Store operation failed:
All snap names are currently subject to a review. 
Please see https://forum.snapcraft.io/t/manual-review-of-all-new-snap-name-registrations/39440 for details.
Follow this link to submit a name request for your snap: https://dashboard.snapcraft.io/register-snap

Full execution log: '/home/alan/.local/state/snapcraft/log/snapcraft-20240719-215118.776921.log'
mr-cal commented 3 months ago

Thanks for the report. I think we need to do 2 things here:

  1. Instead of a SnapcraftInternalError, we should capture and raise a Store error
  2. Parse newlines and ensure the formatting looks good for store errors
syncronize-issues-to-jira[bot] commented 3 months ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-3139.

This message was autogenerated