2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-27 03:19:56 +00:00

Make unexpected error more specific

Often a usable summary message is obfuscated.  Assume the subject line
is safe to relay, but continue to do a more verbose trace.
This commit is contained in:
Jarrod Johnson 2019-07-08 14:28:56 -04:00
parent 3efc153615
commit fbc4fc6846
3 changed files with 16 additions and 7 deletions

View File

@ -504,6 +504,13 @@ def makecall(callout, args):
if 'errorcode' in response:
exitcode = response['errorcode']
sys.stderr.write('Error: ' + response['error'] + '\n')
if 'databynode' in response:
lresponse = response['databynode']
for node in lresponse:
if 'errorcode' in lresponse[node]:
exitcode = lresponse[node]['errorcode']
if 'error' in lresponse[node]:
sys.stderr.write('{0}: Error - {1}\n'.format(node, lresponse[node]['error']))
def clearvalues(resource, attribs):
@ -997,4 +1004,6 @@ if __name__ == '__main__':
if deadline and os.times()[4] < deadline:
sys.stderr.write('[Exited early, hit enter to continue]')
sys.stdin.readline()
if errcode == 0:
errcode = exitcode
sys.exit(errcode)

View File

@ -384,11 +384,11 @@ def resourcehandler(env, start_response):
try:
for rsp in resourcehandler_backend(env, start_response):
yield rsp
except:
except Exception as e:
tracelog.log(traceback.format_exc(), ltype=log.DataTypes.event,
event=log.Events.stacktrace)
start_response('500 - Internal Server Error', [])
yield '500 - Internal Server Error'
start_response('500 - ' + str(e), [])
yield '500 - ' + str(e)
return

View File

@ -182,11 +182,11 @@ def sessionhdl(connection, authname, skipauth=False, cert=None):
send_data(connection, {'_requestdone': 1})
except SystemExit:
sys.exit(0)
except:
except Exception as e:
tracelog.log(traceback.format_exc(), ltype=log.DataTypes.event,
event=log.Events.stacktrace)
send_data(connection, {'errorcode': 500,
'error': 'Unexpected error'})
'error': 'Unexpected error - ' + str(e)})
send_data(connection, {'_requestdone': 1})
request = tlvdata.recv(connection)
@ -313,12 +313,12 @@ def term_interact(authdata, authname, ccons, cfm, connection, consession,
try:
process_request(connection, data, cfm, authdata, authname,
skipauth)
except Exception:
except Exception as e:
tracelog.log(traceback.format_exc(),
ltype=log.DataTypes.event,
event=log.Events.stacktrace)
send_data(connection, {'errorcode': 500,
'error': 'Unexpected error'})
'error': 'Unexpected error - ' + str(e)})
send_data(connection, {'_requestdone': 1})
continue
if not data: