fix: better error detail for failed sql
Some checks failed
Build , Vet Test, and Lint / Run Vet Tests (1.24.x) (push) Failing after -35m9s
Build , Vet Test, and Lint / Build (push) Failing after -35m9s
Tests / Unit Tests (push) Failing after -35m10s
Build , Vet Test, and Lint / Run Vet Tests (1.23.x) (push) Failing after -35m9s
Build , Vet Test, and Lint / Lint Code (push) Failing after -35m9s
Tests / Integration Tests (push) Failing after -35m10s

This commit is contained in:
Hein
2026-05-20 13:06:26 +02:00
parent 0647a88aba
commit c42d09238f
9 changed files with 101 additions and 32 deletions

View File

@@ -3,6 +3,7 @@ package funcspec
import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
@@ -1071,6 +1072,10 @@ func sendError(w http.ResponseWriter, status int, code, message string, err erro
}
if err != nil {
errObj.Detail = err.Error()
var sqlErr *common.SQLError
if errors.As(err, &sqlErr) {
errObj.SQL = sqlErr.SQL
}
}
data, _ := json.Marshal(map[string]interface{}{