瀏覽代碼

Add error

Anton 5 年之前
父節點
當前提交
b0bc24f7c3
共有 2 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      api/studyPlanImport.go
  2. 二進制
      main

+ 3 - 0
api/studyPlanImport.go

@@ -17,6 +17,9 @@ func ImportPlanRoute(w http.ResponseWriter, r *http.Request){
 	}
 	tempname := readFile(input)
 	result := xlsx.ImportXLSX(tempname)
+	if result == nil{
+		json.NewEncoder(w).Encode(struct{Error string}{Error: "Error while processing file"})
+	}
 	json.NewEncoder(w).Encode(result)
 }
 

二進制
main