pyvec / elsa

Helper module for hosting Frozen-Flask based websites on GitHub pages
Other
29 stars 49 forks source link

Failed pushing is not user friendly #26

Closed hroncok closed 7 years ago

hroncok commented 7 years ago

I've hidden the stderr to fix #25.

Now when the push could not happen (maybe bad token or such), this is what is in the log:

Pushing to GitHub...
Traceback (most recent call last):
  File "pyladies_cz.py", line 229, in <module>
    cli(app, freezer=freezer, base_url='http://pyladies.cz')
  File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/elsa/_cli.py", line 127, in cli
    return command()
  File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/elsa/_cli.py", line 125, in deploy
    deploy_(path, push=push)
  File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/elsa/_deployment.py", line 56, in deploy
    quiet=True)
  File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/elsa/_deployment.py", line 22, in run
    return subprocess.run(cmd, **kwargs)
  File "/opt/python/3.5.2/lib/python3.5/subprocess.py", line 708, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['git', 'push', 'origin', 'gh-pages:gh-pages', '--force']' returned non-zero exit status 128

That's not nice, but I wanted to fix #25 ASAP so I didn't bother.

hroncok commented 7 years ago

What about this:

Pushing to GitHub...
Error: git push failed (exit status 128).
Note: Due to security constraints, Elsa does not show the error message from git, as it may include sensitive information and this could be logged. Use the --show-git-push-stderr switch to change this behavior.
hroncok commented 7 years ago

Note to self: This is not the only place where Elsa tracebacks on the user (other places notably: Frozen Flask warnings treated as errors). That should not be acceptable, a decent error message to stderr and an appropriate exit status is usually much nicer.

encukou commented 7 years ago

That message looks good, except a typo: constraints