Debug for error logging

This commit is contained in:
BarsTiger
2022-03-01 15:12:39 +02:00
parent 5708f805ca
commit 7b24c59463
7 changed files with 10 additions and 8 deletions

View File

@@ -24,7 +24,7 @@ def change(email):
r_code = handle(requests.put(horsy_vars.protocol + horsy_vars.server_url + '/users', r_code = handle(requests.put(horsy_vars.protocol + horsy_vars.server_url + '/users',
json={'auth': auth, 'email': email}).status_code) json={'auth': auth, 'email': email}).status_code)
if r_code[1] not in [200, 201]: if r_code[1] not in [200, 201]:
gui.cpopup("Error", r_code[1]) gui.cpopup("Error", r_code[0])
except: except:
gui.cpopup('Error', 'Unexpected error.') gui.cpopup('Error', 'Unexpected error.')
threading.Thread(target=change_in_new_thread).start() threading.Thread(target=change_in_new_thread).start()

View File

@@ -29,6 +29,6 @@ def change(oldpass, newpass):
gui.cpopup("Changing password", gui.cpopup("Changing password",
handle(requests.put(horsy_vars.protocol + horsy_vars.server_url + '/users', handle(requests.put(horsy_vars.protocol + horsy_vars.server_url + '/users',
json={'auth': get_auth(True, login_ui, QtWidgets.QMainWindow()), json={'auth': get_auth(True, login_ui, QtWidgets.QMainWindow()),
'password': newpass}).status_code)[1]) 'password': newpass}).status_code)[0])
except: except:
gui.popup('Error', 'Unexpected error.') gui.popup('Error', 'Unexpected error.')

View File

@@ -18,7 +18,7 @@ def install(package):
r = json.loads(r) r = json.loads(r)
if r_code[1] not in [200, 201]: if r_code[1] not in [200, 201]:
cpopup("Error", r_code[1]) cpopup("Error", r_code[0])
try: try:
UiDownloadWindow.show() UiDownloadWindow.show()

View File

@@ -68,7 +68,7 @@ codes = {'CONTINUE': 100,
401: 'You are not authorized to access this resource, please login', 401: 'You are not authorized to access this resource, please login',
402: 'PAYMENT_REQUIRED', 402: 'PAYMENT_REQUIRED',
403: 'Forbidden, you do not have permission to access this resource or you need to log in', 403: 'Forbidden, you do not have permission to access this resource or you need to log in',
404: 'Not found', 404: 'Not found or you do not have permission to access this resource',
405: 'METHOD_NOT_ALLOWED', 405: 'METHOD_NOT_ALLOWED',
406: 'NOT_ACCEPTABLE', 406: 'NOT_ACCEPTABLE',
407: 'PROXY_AUTHENTICATION_REQUIRED', 407: 'PROXY_AUTHENTICATION_REQUIRED',

View File

@@ -17,7 +17,7 @@ def install(package):
r = json.loads(r) r = json.loads(r)
if r_code[1] not in [200, 201]: if r_code[1] not in [200, 201]:
return r_code[1] return r_code[0]
try: try:
# Inform the user # Inform the user

View File

@@ -15,7 +15,7 @@ def edit(package, UiPackageWindow):
try: try:
r_code = handle(r.status_code) r_code = handle(r.status_code)
if r_code[1] not in [200, 201]: if r_code[1] not in [200, 201]:
gui.cpopup("Error", r_code[1]) gui.cpopup("Error", r_code[0])
r = r.text r = r.text
r = json.loads(r) r = json.loads(r)
except: except:
@@ -43,6 +43,8 @@ def edit(package, UiPackageWindow):
'run': (lambda x: x if x != '' else None)(package_ui.main_exe_box.text()) 'run': (lambda x: x if x != '' else None)(package_ui.main_exe_box.text())
} }
handle(requests.put(f"{horsy_vars.protocol}{horsy_vars.server_url}/packages", json=body).status_code) gui.cpopup("Updating",
handle(requests.put(f"{horsy_vars.protocol}{horsy_vars.server_url}/packages",
json=body).status_code)[0])
package_ui.update_button.clicked.connect(send) package_ui.update_button.clicked.connect(send)

View File

@@ -10,7 +10,7 @@ def get_source(package):
r = requests.get(f"{horsy_vars.protocol}{horsy_vars.server_url}/packages/json/{package}") r = requests.get(f"{horsy_vars.protocol}{horsy_vars.server_url}/packages/json/{package}")
r_code = handle(r.status_code) r_code = handle(r.status_code)
if r_code[1] not in [200, 201]: if r_code[1] not in [200, 201]:
return r_code[1] return r_code[0]
r = r.text r = r.text
r = json.loads(r) r = json.loads(r)