Page MenuHomePhabricator

[webservice] should have more easily understandable error messages when run as a non-tool user
Open, LowPublicBUG REPORT

Description

Running webservice as tool maintainer before any become dies with a somewhat cryptic stack trace:

$ webservice php8.2 shell
Traceback (most recent call last):
  File "/usr/bin/webservice", line 33, in <module>
    sys.exit(load_entry_point('toolforge-webservice==0.103.5', 'console_scripts', 'webservice')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/toolsws/cli/webservice.py", line 227, in main
    tool = Tool.from_currentuser()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/toolsws/tool.py", line 111, in from_currentuser
    return Tool.from_pwd(pwd_entry)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/toolsws/tool.py", line 119, in from_pwd
    raise Tool.InvalidToolException(
toolsws.tool.Tool.InvalidToolException: Tool username should begin with tools.

I know that the folks who coded webservice (👋) understand how to read a Python stack trace, but I don't think the average Toolforge user should need to learn that skill. The "Tool username should begin with tools." error message itself is also insider jargon. Instead a user should see something more like:

$ webservice php8.2 shell
ERROR: `webservice` must be run after `become`ing your tool.

Event Timeline

dcaro subscribed.

This will change automatically once it gets merged into the jobs side of things (as we use a common error handling library to avoid stack traces).

Good to keep in mind anyhow though.

dcaro renamed this task from `webservice` should have more easily understandable error messages when run as a non-tool user to [webservice] should have more easily understandable error messages when run as a non-tool user.Mar 25 2024, 10:05 AM
dcaro moved this task from Backlog to Ready to be worked on on the Toolforge board.