Skip to content
This repository has been archived by the owner on Sep 25, 2024. It is now read-only.

Commands run without configuration fail with ugly stacktrace #3

Closed
pasky opened this issue Jan 23, 2019 · 0 comments
Closed

Commands run without configuration fail with ugly stacktrace #3

pasky opened this issue Jan 23, 2019 · 0 comments
Assignees

Comments

@pasky
Copy link
Member

pasky commented Jan 23, 2019

Example:

pasky@gundi:~/elisctl$ elisctl csv get
Traceback (most recent call last):
  File "/usr/local/bin/elisctl", line 11, in <module>
    load_entry_point('elis-tools', 'console_scripts', 'elisctl')()
  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 "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/pasky/elisctl/elisctl/csv.py", line 47, in download_command
    rsp = api_client.get(f"byperiod/{ceil(step.total_seconds())}/{int(start.timestamp())}")
  File "/Users/pasky/elisctl/elisctl/lib/api_client.py", line 82, in get
    return self._request_url("get", f"{self.url}/{path}", query)
  File "/Users/pasky/elisctl/elisctl/lib/api_client.py", line 58, in url
    _url = get_credential("url").rstrip("/")
  File "/Users/pasky/elisctl/elisctl/configure.py", line 40, in get_credential
    res = config["default"].get(attr)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 958, in __getitem__
    raise KeyError(key)
KeyError: 'default'

We should guide the user to configure elisctl first.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants