Skip to content

Commit d9a1f72

Browse files
committed
improved error handling when starting server
1 parent f9694bb commit d9a1f72

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/handlers.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,9 +576,9 @@ func StartServer(w http.ResponseWriter, r *http.Request) {
576576

577577
// Check if savefile was submitted with request to start server.
578578
if FactorioServ.Savefile == "" {
579-
log.Printf("Error starting Factorio server: %s", err)
579+
log.Printf("Error starting Factorio server: no save file provided")
580580
resp.Success = false
581-
resp.Data = fmt.Sprintf("Error starting Factorio server: %s", err)
581+
resp.Data = fmt.Sprintf("Error starting Factorio server: %s", "No save file provided")
582582
if err := json.NewEncoder(w).Encode(resp); err != nil {
583583
log.Printf("Error encoding config file JSON reponse: ", err)
584584
}
@@ -599,7 +599,7 @@ func StartServer(w http.ResponseWriter, r *http.Request) {
599599
if FactorioServ.Running {
600600
resp.Data = fmt.Sprintf("Factorio server with save: %s started on port: %d", FactorioServ.Savefile, FactorioServ.Port)
601601
resp.Success = true
602-
log.Printf("Factorio server started on port: %s", FactorioServ.Port)
602+
log.Printf("Factorio server started on port: %v", FactorioServ.Port)
603603
if err := json.NewEncoder(w).Encode(resp); err != nil {
604604
log.Printf("Error encoding config file JSON reponse: ", err)
605605
}

0 commit comments

Comments
 (0)