New errors handling

This commit is contained in:
BarsTiger
2022-01-23 22:45:25 +02:00
parent c7ff676e1d
commit aa2a77eea3

View File

@@ -120,17 +120,16 @@ def upload():
print('[red]Internal server error, request is broken[/red]') print('[red]Internal server error, request is broken[/red]')
break break
elif r['message'] == 'Invalid body':
print('[red]Invalid request body, try again[/red]')
break
elif r['message'] == 'Success': elif r['message'] == 'Success':
print('[green]Success, your project is created. You can install it by running[/] ' print('[green]Success, your project is created. You can install it by running[/] '
'[i]horsy install {0}[/]'.format(request['name'])) '[i]horsy install {0}[/]'.format(request['name']))
break break
elif 'already exists' in r['message']:
print(f"[red]{r['message']}[/red]")
else: else:
print('[red]Unknown error[/red]') print('[red]Unknown error, please try again[/red]')
print('Server response:') print('Server response:')
print(r) print(r)
break break