Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
b5ca475b3f
|
|||
a75b1291cb
|
|||
21cd1ee066
|
@@ -112,6 +112,13 @@ func (b *Builder) WithMessage(msg string) *Builder {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
func (b *Builder) WithStackSkip(stacktraceskip int) *Builder {
|
||||
b.errorData.Caller = callername(stacktraceskip)
|
||||
return b
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Err changes the Severity to ERROR (default)
|
||||
// The error will be:
|
||||
//
|
||||
|
@@ -612,7 +612,18 @@ func (v MetaValue) rawValueForJson() any {
|
||||
if v.Value.(AnyWrap).IsNil {
|
||||
return nil
|
||||
}
|
||||
return v.Value.(AnyWrap).Serialize()
|
||||
if v.Value.(AnyWrap).IsError {
|
||||
return bson.M{"@error": true}
|
||||
}
|
||||
jsonobj := primitive.M{}
|
||||
jsonarr := primitive.A{}
|
||||
if err := json.Unmarshal([]byte(v.Value.(AnyWrap).Json), &jsonobj); err == nil {
|
||||
return jsonobj
|
||||
} else if err := json.Unmarshal([]byte(v.Value.(AnyWrap).Json), &jsonarr); err == nil {
|
||||
return jsonarr
|
||||
} else {
|
||||
return bson.M{"type": v.Value.(AnyWrap).Type, "data": v.Value.(AnyWrap).Json}
|
||||
}
|
||||
}
|
||||
if v.DataType == MDTID {
|
||||
if v.Value.(IDWrap).IsNil {
|
||||
|
@@ -207,7 +207,7 @@ func Error(e error) HTTPResponse {
|
||||
|
||||
func ErrWrap(e error, errorType exerr.ErrorType, msg string) HTTPResponse {
|
||||
return &jsonAPIErrResponse{
|
||||
err: exerr.FromError(exerr.Wrap(e, msg).WithType(errorType).Build()),
|
||||
err: exerr.FromError(exerr.Wrap(e, msg).WithStackSkip(2).WithType(errorType).Build()),
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
package goext
|
||||
|
||||
const GoextVersion = "0.0.248"
|
||||
const GoextVersion = "0.0.251"
|
||||
|
||||
const GoextVersionTimestamp = "2023-08-21T15:08:35+0200"
|
||||
const GoextVersionTimestamp = "2023-08-22T10:21:13+0200"
|
||||
|
Reference in New Issue
Block a user