fix exceptions

This commit is contained in:
Jack 2016-08-09 14:29:59 -04:00
parent 36b41081ab
commit e9f5b43785

View file

@ -377,8 +377,9 @@ class LBRYDaemon(jsonrpc.JSONRPC):
log.info("Done writing lbrycrd.conf") log.info("Done writing lbrycrd.conf")
def _responseFailed(self, err, call): def _responseFailed(self, err, call):
log.error(err.getTraceback()) log.debug(err.getTraceback())
call.cancel() if call.active():
call.cancel()
def render(self, request): def render(self, request):
request.content.seek(0, 0) request.content.seek(0, 0)
@ -421,10 +422,11 @@ class LBRYDaemon(jsonrpc.JSONRPC):
d = defer.maybeDeferred(function, *args) d = defer.maybeDeferred(function, *args)
# cancel the response if the connection is broken # cancel the response if the connection is broken
request.notifyFinish().addErrback(self._responseFailed, d) notify_finish = request.notifyFinish()
notify_finish.addErrback(self._responseFailed, d)
d.addErrback(self._ebRender, id) d.addErrback(self._ebRender, id)
d.addCallback(self._cbRender, request, id, version) d.addCallback(self._cbRender, request, id, version)
d.addErrback(notify_finish.errback)
return server.NOT_DONE_YET return server.NOT_DONE_YET
def _cbRender(self, result, request, id, version): def _cbRender(self, result, request, id, version):
@ -1128,7 +1130,7 @@ class LBRYDaemon(jsonrpc.JSONRPC):
def _get_est_cost(self, name): def _get_est_cost(self, name):
def _check_est(d, name): def _check_est(d, name):
try: try:
if d.result: if isinstance(d.result, float):
log.info("Cost est for lbry://" + name + ": " + str(d.result) + "LBC") log.info("Cost est for lbry://" + name + ": " + str(d.result) + "LBC")
return defer.succeed(None) return defer.succeed(None)
except AttributeError: except AttributeError: