Fix bad exception handling in cases of 0 CSVs in import ZIPs
This commit is contained in:
parent
0163cf985f
commit
12182b3bc7
|
@ -80,6 +80,8 @@ func handleImportSubscribers(c echo.Context) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return echo.NewHTTPError(http.StatusInternalServerError,
|
return echo.NewHTTPError(http.StatusInternalServerError,
|
||||||
fmt.Sprintf("Error extracting ZIP file: %v", err))
|
fmt.Sprintf("Error extracting ZIP file: %v", err))
|
||||||
|
} else if len(files) == 0 {
|
||||||
|
return echo.NewHTTPError(http.StatusBadRequest, "No CSV files found to import.")
|
||||||
}
|
}
|
||||||
go impSess.LoadCSV(dir+"/"+files[0], rune(r.Delim[0]))
|
go impSess.LoadCSV(dir+"/"+files[0], rune(r.Delim[0]))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue