mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 13:56:27 +01:00
* Add gql client generation files * Update dependencies * Add stash-box client generation to the makefile * Move scraped scene object matchers to models * Add stash-box to scrape with dropdown * Add scrape scene from fingerprint in UI
33 lines
691 B
Go
33 lines
691 B
Go
package graphql
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/vektah/gqlparser/v2/gqlerror"
|
|
)
|
|
|
|
type ErrorPresenterFunc func(ctx context.Context, err error) *gqlerror.Error
|
|
|
|
type ExtendedError interface {
|
|
Extensions() map[string]interface{}
|
|
}
|
|
|
|
func DefaultErrorPresenter(ctx context.Context, err error) *gqlerror.Error {
|
|
if gqlerr, ok := err.(*gqlerror.Error); ok {
|
|
if gqlerr.Path == nil {
|
|
gqlerr.Path = GetFieldContext(ctx).Path()
|
|
}
|
|
return gqlerr
|
|
}
|
|
|
|
var extensions map[string]interface{}
|
|
if ee, ok := err.(ExtendedError); ok {
|
|
extensions = ee.Extensions()
|
|
}
|
|
|
|
return &gqlerror.Error{
|
|
Message: err.Error(),
|
|
Path: GetFieldContext(ctx).Path(),
|
|
Extensions: extensions,
|
|
}
|
|
}
|