Skip to content
Snippets Groups Projects

Cryptfile exception handling

Merged neodarz requested to merge neodarz/cli:cryptfile_exception_handling into master
+ 6
1
@@ -95,7 +95,12 @@ def set_server(ctx, url, token):
parsed = urllib.parse.urlparse(url)
ctx.obj["SERVER_NETLOC"] = parsed.netloc
ctx.obj["SERVER_PROTOCOL"] = parsed.scheme
token = token or keyring.get_password(url, "_")
try:
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(
domain=ctx.obj["SERVER_NETLOC"],
protocol=ctx.obj["SERVER_PROTOCOL"],
Loading