canonical / snapcraft

Package, distribute, and update any app for Linux and IoT.

Home Page:https://snapcraft.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve how errors are raised before the dispatcher is created

mr-cal opened this issue · comments

What needs to get done

Add a pre-craft-cli error handler or move the validation to after the dispatcher is created.

Why it needs to get done

There are a few errors that can get raised in _get_dispatcher before the dispatcher is created:

  1. ESM base errors
  2. remote-build errors

These errors create tracebacks that do not look good for end users:

Traceback (most recent call last):
  File "/home/developer/dev/snapcraft/venv/bin/snapcraft", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/developer/dev/snapcraft/snapcraft/application.py", line 351, in main
    return app.run()
           ^^^^^^^^^
  File "/home/developer/dev/snapcraft/snapcraft/application.py", line 179, in run
    return_code = super().run()
                  ^^^^^^^^^^^^^
  File "/home/developer/dev/snapcraft/venv/lib/python3.12/site-packages/craft_application/application.py", line 492, in run
    dispatcher = self._get_dispatcher()
                 ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/developer/dev/snapcraft/snapcraft/application.py", line 260, in _get_dispatcher
    _get_esm_error_for_base(base)
  File "/home/developer/dev/snapcraft/snapcraft/application.py", line 79, in _get_esm_error_for_base
    raise RuntimeError(
RuntimeError: ERROR: base 'core18' was last supported on Snapcraft 7 available on the '7.x' channel.

Thank you for reporting us your feedback!

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

This message was autogenerated