Replaced UserWarnings with proper exceptions

This commit is contained in:
2Shirt 2019-08-09 20:10:13 -06:00
parent 147b9d2035
commit d722754f12
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -349,7 +349,7 @@ def major_exception():
try:
upload_debug_report(report, reason='CRASH')
except Exception: #pylint: disable=broad-except
print_colored(['FAILED'], ['RED'])
print_error('FAILED')
LOG.error('Upload failed', exc_info=True)
else:
print_success('SUCCESS')
@ -566,7 +566,7 @@ def upload_debug_report(report, compress=True, reason='DEBUG'):
msg = 'Server details missing, aborting upload.'
LOG.error(msg)
print_error(msg)
raise UserWarning(msg)
raise RuntimeError(msg)
# Set filename (based on the logging config if possible)
filename = 'Unknown'
@ -597,8 +597,7 @@ def upload_debug_report(report, compress=True, reason='DEBUG'):
# Check response
if not response.ok:
# Using generic exception since we don't care why this failed
raise Exception('Failed to upload report')
raise RuntimeError('Failed to upload report')
if __name__ == '__main__':