Skip to content
Snippets Groups Projects
Verified Commit 34464f28 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Improved error landing when not logged in

parent b1268507
No related branches found
No related tags found
1 merge request!5Resolve "Provide precompiled binaries for easier install"
...@@ -60,10 +60,18 @@ def async_command(f): ...@@ -60,10 +60,18 @@ def async_command(f):
_async_reraise = kwargs.pop("_async_reraise", False) _async_reraise = kwargs.pop("_async_reraise", False)
try: try:
return loop.run_until_complete(f(*args, **kwargs)) return loop.run_until_complete(f(*args, **kwargs))
except (exceptions.FunkwhaleError, aiohttp.client_exceptions.ClientError) as e: except (aiohttp.client_exceptions.ClientError) as e:
if _async_reraise: if _async_reraise:
raise raise
raise click.ClickException(str(e)) message = str(e)
if hasattr(e, 'status') and e.status == 401:
message = "Remote answered with {}, ensure your are logged in first".format(e.status)
raise click.ClickException(message)
except (exceptions.FunkwhaleError) as e:
if _async_reraise:
raise
message = str(e)
raise click.ClickException(message)
else: else:
raise raise
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment