Fixed mistake in error handling code that causes silent errors

This commit is contained in:
2025-05-21 14:11:36 +01:00
parent 2ed4c89078
commit d34a996c3c

View File

@@ -3,6 +3,7 @@ package main
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"errors"
"fmt" "fmt"
"io" "io"
"log" "log"
@@ -100,6 +101,9 @@ func handleCreateModel(w http.ResponseWriter, r *http.Request) {
blenderOutput := string(output) blenderOutput := string(output)
if err != nil || strings.Contains(blenderOutput, "Traceback") || strings.Contains(blenderOutput, "Error:") { if err != nil || strings.Contains(blenderOutput, "Traceback") || strings.Contains(blenderOutput, "Error:") {
log.Printf("Command execution failed: %v, Output: %s", err, blenderOutput) log.Printf("Command execution failed: %v, Output: %s", err, blenderOutput)
if err == nil {
err = errors.New("Python error")
}
errorResponse := struct { errorResponse := struct {
Error string `json:"error"` Error string `json:"error"`
BlenderLog string `json:"blender_log"` BlenderLog string `json:"blender_log"`