Skip to content

Commit

Permalink
better error handling for importer log
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas committed Apr 26, 2024
1 parent 0bba2f9 commit fd6bd69
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions server/handler/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,14 +705,17 @@ def handleApiRequest(self, type, subtype, requestparam, **kwargs):
name=AVNUtil.getHttpRequestParam(requestparam,"name",True)
lastBytes=AVNUtil.getHttpRequestParam(requestparam,"maxBytes",False)
candidate=self.findCandidate(name)
rt=None
if candidate is None:
return AVNUtil.getReturnData(error="%s not found"%name)
logName=self.getLogFileName(candidate.name,True)
if logName is None:
return AVNUtil.getReturnData(error="log for %s not found"%name)
filename=os.path.basename(logName)
handler.writeFromDownload(
AVNDownload(logName,lastBytes=lastBytes),filename=filename)
rt=AVNDownloadError("%s not found"%name)
if rt is None:
logName=self.getLogFileName(candidate.name,True)
if logName is None:
rt=AVNDownloadError("log for %s not found"%name)
if rt is None:
filename=os.path.basename(logName)
rt=AVNDownload(logName,lastBytes=lastBytes,dlname=filename)
handler.writeFromDownload(rt)
return None
return AVNUtil.getReturnData(error="unknown command for import")

Expand Down

0 comments on commit fd6bd69

Please sign in to comment.