1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-22 08:42:32 -05:00

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:
Gusted 2024-02-13 07:35:25 +00:00
commit 91d40751c7

View file

@ -7,6 +7,7 @@ package db
import (
"context"
"database/sql"
"errors"
"fmt"
"io"
"reflect"
@ -342,7 +343,7 @@ func (ErrorQueryHook) BeforeProcess(c *contexts.ContextHook) (context.Context, e
}
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)
}
return nil