Skip to content
Snippets Groups Projects
Commit 19c4b751 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Merge branch 'cryptfile_exception_handling' into 'master'

Cryptfile exception handling

Closes #3

See merge request !2
parents 1c936f6b d73f67cc
No related branches found
No related tags found
1 merge request!2Cryptfile exception handling
...@@ -95,7 +95,12 @@ def set_server(ctx, url, token): ...@@ -95,7 +95,12 @@ def set_server(ctx, url, token):
parsed = urllib.parse.urlparse(url) parsed = urllib.parse.urlparse(url)
ctx.obj["SERVER_NETLOC"] = parsed.netloc ctx.obj["SERVER_NETLOC"] = parsed.netloc
ctx.obj["SERVER_PROTOCOL"] = parsed.scheme ctx.obj["SERVER_PROTOCOL"] = parsed.scheme
try:
token = token or keyring.get_password(url, "_") token = token or keyring.get_password(url, "_")
except ValueError as e:
raise click.ClickException("Error while retrieving password from keyring: {}. Your password may be incorrect.".format(e.args[0]))
except Exception as e:
raise click.ClickException("Error while retrieving password from keyring: {}".format(e.args[0]))
ctx.obj["remote"] = api.get_api( ctx.obj["remote"] = api.get_api(
domain=ctx.obj["SERVER_NETLOC"], domain=ctx.obj["SERVER_NETLOC"],
protocol=ctx.obj["SERVER_PROTOCOL"], protocol=ctx.obj["SERVER_PROTOCOL"],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment