mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
Error logging improvements (#3768)
* Improve auto-tag error messages * Ignore another context canceled error * Ignore more graphql context canceled errors
This commit is contained in:
@@ -11,27 +11,29 @@ import (
|
||||
)
|
||||
|
||||
func gqlErrorHandler(ctx context.Context, e error) *gqlerror.Error {
|
||||
// log all errors - for now just log the error message
|
||||
// we can potentially add more context later
|
||||
fc := graphql.GetFieldContext(ctx)
|
||||
if fc != nil && !errors.Is(e, context.Canceled) {
|
||||
logger.Errorf("%s: %v", fc.Path(), e)
|
||||
if !errors.Is(ctx.Err(), context.Canceled) {
|
||||
// log all errors - for now just log the error message
|
||||
// we can potentially add more context later
|
||||
fc := graphql.GetFieldContext(ctx)
|
||||
if fc != nil {
|
||||
logger.Errorf("%s: %v", fc.Path(), e)
|
||||
|
||||
// log the args in debug level
|
||||
logger.DebugFunc(func() (string, []interface{}) {
|
||||
var args interface{}
|
||||
args = fc.Args
|
||||
// log the args in debug level
|
||||
logger.DebugFunc(func() (string, []interface{}) {
|
||||
var args interface{}
|
||||
args = fc.Args
|
||||
|
||||
s, _ := json.Marshal(args)
|
||||
if len(s) > 0 {
|
||||
args = string(s)
|
||||
}
|
||||
s, _ := json.Marshal(args)
|
||||
if len(s) > 0 {
|
||||
args = string(s)
|
||||
}
|
||||
|
||||
return "%s: %v", []interface{}{
|
||||
fc.Path(),
|
||||
args,
|
||||
}
|
||||
})
|
||||
return "%s: %v", []interface{}{
|
||||
fc.Path(),
|
||||
args,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// we may also want to transform the error message for the response
|
||||
|
||||
Reference in New Issue
Block a user