Tests[SendInvalidPriority]

This commit is contained in:
2022-11-30 21:51:48 +01:00
parent 1ca09c16d3
commit e0ecd4d9ff
4 changed files with 159 additions and 21 deletions

View File

@@ -1,12 +1,12 @@
package ginresp
type apiError struct {
Success bool `json:"success"`
Error int `json:"error"`
ErrorHighlight int `json:"errhighlight"`
Message string `json:"message"`
RawError string `json:"errorObj,omitempty"`
Trace string `json:"traceObj,omitempty"`
Success bool `json:"success"`
Error int `json:"error"`
ErrorHighlight int `json:"errhighlight"`
Message string `json:"message"`
RawError *string `json:"errorObj,omitempty"`
Trace string `json:"traceObj,omitempty"`
}
type compatAPIError struct {

View File

@@ -7,6 +7,7 @@ import (
"fmt"
"github.com/gin-gonic/gin"
"github.com/rs/zerolog/log"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
"runtime/debug"
)
@@ -104,7 +105,7 @@ func createApiError(g *gin.Context, ident string, status int, errorid apierr.API
Error: int(errorid),
ErrorHighlight: int(highlight),
Message: msg,
RawError: fmt.Sprintf("%+v", e),
RawError: langext.Ptr(langext.Conditional(e == nil, "", fmt.Sprintf("%+v", e))),
Trace: string(debug.Stack()),
},
}