21
0
Fork 0

v0.0.361 call exerrListener in ginext.Error
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m37s Details

This commit is contained in:
Mike Schwörer 2024-01-07 04:01:13 +01:00
parent 5fba7e0e2f
commit d38fa60fbc
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
4 changed files with 10 additions and 10 deletions

View File

@ -420,7 +420,7 @@ func (b *Builder) Build() error {
b.errorData.ShortLog(stackSkipLogger.Error())
}
b.CallListener(MethodBuild)
b.errorData.CallListener(MethodBuild)
return b.errorData
}
@ -442,7 +442,7 @@ func (b *Builder) Output(ctx context.Context, g *gin.Context) {
b.errorData.Log(stackSkipLogger.Warn())
}
b.CallListener(MethodOutput)
b.errorData.CallListener(MethodOutput)
}
// Print prints the error
@ -454,7 +454,7 @@ func (b *Builder) Print() {
b.errorData.ShortLog(stackSkipLogger.Warn())
}
b.CallListener(MethodPrint)
b.errorData.CallListener(MethodPrint)
}
func (b *Builder) Format(level LogPrintLevel) string {
@ -467,7 +467,7 @@ func (b *Builder) Fatal() {
b.errorData.Severity = SevFatal
b.errorData.Log(stackSkipLogger.WithLevel(zerolog.FatalLevel))
b.CallListener(MethodFatal)
b.errorData.CallListener(MethodFatal)
os.Exit(1)
}

View File

@ -25,13 +25,11 @@ func RegisterListener(l Listener) {
listener = append(listener, l)
}
func (b *Builder) CallListener(m Method) {
valErr := b.errorData
func (ee *ExErr) CallListener(m Method) {
listenerLock.Lock()
defer listenerLock.Unlock()
for _, v := range listener {
v(m, valErr)
v(m, ee)
}
}

View File

@ -328,6 +328,8 @@ type jsonAPIErrResponse struct {
func (j jsonAPIErrResponse) Write(g *gin.Context) {
j.err.Output(g)
j.err.CallListener(exerr.MethodOutput)
}
func (j jsonAPIErrResponse) WithHeader(k string, v string) HTTPResponse {

View File

@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.360"
const GoextVersion = "0.0.361"
const GoextVersionTimestamp = "2024-01-06T01:31:07+0100"
const GoextVersionTimestamp = "2024-01-07T04:01:12+0100"