ソースを参照

Check originData.Error only if processing failed

DarthSim 1 ヶ月 前
コミット
13074eac5c
1 ファイル変更4 行追加3 行削除
  1. 4 3
      processing_handler.go

+ 4 - 3
processing_handler.go

@@ -495,12 +495,13 @@ func handleProcessing(reqID string, rw http.ResponseWriter, r *http.Request) {
 		return processing.ProcessImage(ctx, originData, po)
 	}()
 
-	if originData.Error() != nil {
+	if err != nil {
+		// First, check if the processing error wasn't caused by an image data error
 		checkErr(ctx, "download", originData.Error())
+		// If it wasn't, than it was a processing error
+		sendErrAndPanic(ctx, "processing", err)
 	}
 
-	checkErr(ctx, "processing", err)
-
 	defer result.OutData.Close()
 
 	checkErr(ctx, "timeout", router.CheckTimeout(ctx))