Nicer error message for heroku publish name clash
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 11.5k
- Forks
- 904
- Avg merge
- 4d 17h
- Merged PRs (30d)
- 18
Description
If you try to publish to Heroku using no set name (i.e. the default datasette name) and a project already exists under that name, you get a meaningful error report on the first line followed by Py error messages that drown it out:
Creating datasette... !
▸ Name datasette is already taken
Traceback (most recent call last):
File "/usr/local/bin/datasette", line 10, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Users/NNNNN/Library/Python/3.7/lib/python/site-packages/datasette/publish/heroku.py", line 124, in heroku
create_output = check_output(cmd).decode("utf8")
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 411, in check_output
**kwargs).stdout
File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 512, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['heroku', 'apps:create', 'datasette', '--json']' returned non-zero exit status 1.
It would be neater if:
- the Py error message was caught;
- the report suggested setting a project name using
-netc.
It may also be useful to provide a command to list the current names that are being used, which I assume is available via a Heroku call?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in datasette/publish/heroku.py around line 124, where heroku apps:create datasette --json is run. Reproduce the name-clash case with the Heroku publish command and inspect how the subprocess error is reported. Done means the traceback is replaced by a concise message that suggests choosing a project name with -n; listing existing names is an optional follow-up mentioned in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100