Change in python/osmo-python-tests[master]: Trap handlers: adjust http error log

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Thu Dec 6 10:35:32 UTC 2018


Max has submitted this change and it was merged. ( https://gerrit.osmocom.org/12149 )

Change subject: Trap handlers: adjust http error log
......................................................................

Trap handlers: adjust http error log

Log repr() of error because it's more conscience which makes it easier to
read the logs: in case of "e" there's additional
"Failure instance: Traceback (failure with no frames)" prefix which is
pretty useless because we won't have proper tracebacks for deferred anyway.

Change-Id: I39870b83cacee9a589636974d04e356ef0d32345
---
M scripts/ctrl2cgi.py
M scripts/soap.py
2 files changed, 2 insertions(+), 2 deletions(-)

Approvals:
  daniel: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/scripts/ctrl2cgi.py b/scripts/ctrl2cgi.py
index 81674d8..28a7c3b 100755
--- a/scripts/ctrl2cgi.py
+++ b/scripts/ctrl2cgi.py
@@ -64,7 +64,7 @@
 def make_async_req(ts, dst, par, f_write, f_log, tout):
     d = post(dst, par, timeout=tout)
     d.addCallback(collect, partial(handle_reply, ts, par['bsc_id'], f_write, f_log)) # treq's collect helper is handy to get all reply content at once
-    d.addErrback(lambda e: f_log.critical("HTTP POST error %s while trying to register BSC %s on %s (timeout %d)" % (e, par['bsc_id'], dst, tout))) # handle HTTP errors
+    d.addErrback(lambda e: f_log.critical("HTTP POST error %s while trying to register BSC %s on %s (timeout %d)" % (repr(e), par['bsc_id'], dst, tout))) # handle HTTP errors
     return d
 
 class Trap(CTRL):
diff --git a/scripts/soap.py b/scripts/soap.py
index 5817988..0cb2184 100755
--- a/scripts/soap.py
+++ b/scripts/soap.py
@@ -90,7 +90,7 @@
         ctx = self.factory.client.registerSiteLocation(bsc, float(params['lon']), float(params['lat']), params['position_validity'], params['time_stamp'], params['oper_status'], params['admin_status'], params['policy_status'])
         d = post(self.factory.location, ctx.envelope)
         d.addCallback(collect, partial(handle_reply, ctx.process_reply, params['bsc_id'], self.transport.write, self.factory.log)) # treq's collect helper is handy to get all reply content at once using closure on ctx
-        d.addErrback(lambda e, bsc: self.factory.log.critical("HTTP POST error %s while trying to register BSC %s on %s" % (e, bsc, self.factory.location)), bsc) # handle HTTP errors
+        d.addErrback(lambda e, bsc: self.factory.log.critical("HTTP POST error %s while trying to register BSC %s on %s" % (repr(e), bsc, self.factory.location)), bsc) # handle HTTP errors
         # Ensure that we run only limited number of requests in parallel:
         yield self.factory.semaphore.acquire()
         yield d # we end up here only if semaphore is available which means it's ok to fire the request without exceeding the limit

-- 
To view, visit https://gerrit.osmocom.org/12149
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I39870b83cacee9a589636974d04e356ef0d32345
Gerrit-Change-Number: 12149
Gerrit-PatchSet: 2
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181206/7c419559/attachment.htm>


More information about the gerrit-log mailing list