Browse Source

Check originData.Error only if processing failed

DarthSim 1 tháng trước cách đây
mục cha
commit
13074eac5c
1 tập tin đã thay đổi với 4 bổ sung3 xóa
  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))