1
0
mirror of https://github.com/raseels-repos/golang-saas-starter-kit.git synced 2025-07-17 01:42:36 +02:00

Add stacktrace to error response

This commit is contained in:
Lee Brown
2020-01-14 10:49:19 -08:00
parent 8aca18a353
commit 59554a22d5
2 changed files with 6 additions and 1 deletions

View File

@ -10,6 +10,9 @@
{{ if .Details }} {{ if .Details }}
<p class="text-gray-500 mb-0">{{ .Details }}</p> <p class="text-gray-500 mb-0">{{ .Details }}</p>
{{ end }} {{ end }}
{{ if .StackTrace }}
<p class="text-gray-500 mb-0">{{ .StackTrace }}</p>
{{ end }}
</div> </div>
</div> </div>
{{ end }} {{ end }}

View File

@ -4,6 +4,7 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"html/template"
"net/http" "net/http"
"os" "os"
"path" "path"
@ -200,7 +201,8 @@ func RenderError(ctx context.Context, w http.ResponseWriter, r *http.Request, er
data := map[string]interface{}{ data := map[string]interface{}{
"StatusCode": resp.StatusCode, "StatusCode": resp.StatusCode,
"Error": resp.Error, "Error": resp.Error,
"Details": resp.Details, "Details": template.HTML(resp.Details),
"StackTrace": template.HTML(resp.StackTrace),
"Fields": resp.Fields, "Fields": resp.Fields,
} }