mirror of
https://github.com/Cian-H/simple_blender_server.git
synced 2025-12-22 21:41:56 +00:00
Fixed mistake in error handling code that causes silent errors
This commit is contained in:
4
main.go
4
main.go
@@ -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"`
|
||||||
|
|||||||
Reference in New Issue
Block a user