Merge pull request '[FEAT] Don't log context cancelled SQL errors (squash)' (#2330) from gusted/forgejo-no-db into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2330 Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
commit
91d40751c7
|
@ -7,6 +7,7 @@ package db
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
@ -342,7 +343,7 @@ func (ErrorQueryHook) BeforeProcess(c *contexts.ContextHook) (context.Context, e
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *ErrorQueryHook) AfterProcess(c *contexts.ContextHook) error {
|
func (h *ErrorQueryHook) AfterProcess(c *contexts.ContextHook) error {
|
||||||
if c.Err != nil {
|
if c.Err != nil && !errors.Is(c.Err, context.Canceled) {
|
||||||
h.Logger.Log(8, log.ERROR, "[Error SQL Query] %s %v - %v", c.SQL, c.Args, c.Err)
|
h.Logger.Log(8, log.ERROR, "[Error SQL Query] %s %v - %v", c.SQL, c.Args, c.Err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue