소스 검색

Add error

Anton 5 년 전
부모
커밋
b0bc24f7c3
2개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      api/studyPlanImport.go
  2. BIN
      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)
 }
 

BIN
main