v0.0.361 call exerrListener in ginext.Error
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m37s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m37s
This commit is contained in:
parent
5fba7e0e2f
commit
d38fa60fbc
@ -420,7 +420,7 @@ func (b *Builder) Build() error {
|
|||||||
b.errorData.ShortLog(stackSkipLogger.Error())
|
b.errorData.ShortLog(stackSkipLogger.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
b.CallListener(MethodBuild)
|
b.errorData.CallListener(MethodBuild)
|
||||||
|
|
||||||
return b.errorData
|
return b.errorData
|
||||||
}
|
}
|
||||||
@ -442,7 +442,7 @@ func (b *Builder) Output(ctx context.Context, g *gin.Context) {
|
|||||||
b.errorData.Log(stackSkipLogger.Warn())
|
b.errorData.Log(stackSkipLogger.Warn())
|
||||||
}
|
}
|
||||||
|
|
||||||
b.CallListener(MethodOutput)
|
b.errorData.CallListener(MethodOutput)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print prints the error
|
// Print prints the error
|
||||||
@ -454,7 +454,7 @@ func (b *Builder) Print() {
|
|||||||
b.errorData.ShortLog(stackSkipLogger.Warn())
|
b.errorData.ShortLog(stackSkipLogger.Warn())
|
||||||
}
|
}
|
||||||
|
|
||||||
b.CallListener(MethodPrint)
|
b.errorData.CallListener(MethodPrint)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) Format(level LogPrintLevel) string {
|
func (b *Builder) Format(level LogPrintLevel) string {
|
||||||
@ -467,7 +467,7 @@ func (b *Builder) Fatal() {
|
|||||||
b.errorData.Severity = SevFatal
|
b.errorData.Severity = SevFatal
|
||||||
b.errorData.Log(stackSkipLogger.WithLevel(zerolog.FatalLevel))
|
b.errorData.Log(stackSkipLogger.WithLevel(zerolog.FatalLevel))
|
||||||
|
|
||||||
b.CallListener(MethodFatal)
|
b.errorData.CallListener(MethodFatal)
|
||||||
|
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
@ -25,13 +25,11 @@ func RegisterListener(l Listener) {
|
|||||||
listener = append(listener, l)
|
listener = append(listener, l)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Builder) CallListener(m Method) {
|
func (ee *ExErr) CallListener(m Method) {
|
||||||
valErr := b.errorData
|
|
||||||
|
|
||||||
listenerLock.Lock()
|
listenerLock.Lock()
|
||||||
defer listenerLock.Unlock()
|
defer listenerLock.Unlock()
|
||||||
|
|
||||||
for _, v := range listener {
|
for _, v := range listener {
|
||||||
v(m, valErr)
|
v(m, ee)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -328,6 +328,8 @@ type jsonAPIErrResponse struct {
|
|||||||
|
|
||||||
func (j jsonAPIErrResponse) Write(g *gin.Context) {
|
func (j jsonAPIErrResponse) Write(g *gin.Context) {
|
||||||
j.err.Output(g)
|
j.err.Output(g)
|
||||||
|
|
||||||
|
j.err.CallListener(exerr.MethodOutput)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j jsonAPIErrResponse) WithHeader(k string, v string) HTTPResponse {
|
func (j jsonAPIErrResponse) WithHeader(k string, v string) HTTPResponse {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package goext
|
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"
|
||||||
|
Loading…
Reference in New Issue
Block a user