msanders / cider

Hassle-free bootstrapping with Homebrew.
https://pypi.python.org/pypi/cider/
MIT License
839 stars 25 forks source link

Attribute Error while handling No symlink with name #50

Closed kishansairam9 closed 5 years ago

kishansairam9 commented 5 years ago

When no symlink is present and trying to unlink, following error is occured:

~/.cider/symlinks master*
❯ ls
zsh

~/.cider/symlinks master*
❯ cider unlink sls
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/cider/_cli.py", line 251, in main
    cli.main(standalone_mode=False)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 644, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 991, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 837, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 26, in new_func
    return ctx.invoke(f, ctx.obj, *args[1:], **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 464, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/cider/_cli.py", line 246, in unlink
    cider.unlink(name)
  File "/usr/local/lib/python3.7/site-packages/cider/core.py", line 653, in unlink
    raise StowError("No symlink found with name: {0}".format(name))
cider.exceptions.StowError: No symlink found with name: sls

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/cider", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/cider/_cli.py", line 269, in main
    tty.puterr(e.message, prefix="Error:")
AttributeError: 'StowError' object has no attribute 'message'

Cause of Error: No Message attribute for StowError

Fix: https://github.com/kishansairam9/cider/commit/704f2c43e9674a8ba8e66ec2ff5ad2c47b56043f Replace e.message with e

After Fix:

~/.cider/symlinks master*
❯ cider unlink sls
Error: No symlink found with name: sls