github.com/weaviate/weaviate@v1.24.6/entities/errors/errors_graphql.go (about) 1 // _ _ 2 // __ _____ __ ___ ___ __ _| |_ ___ 3 // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \ 4 // \ V V / __/ (_| |\ V /| | (_| | || __/ 5 // \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___| 6 // 7 // Copyright © 2016 - 2024 Weaviate B.V. All rights reserved. 8 // 9 // CONTACT: hello@weaviate.io 10 // 11 12 package errors 13 14 import ( 15 "errors" 16 "fmt" 17 ) 18 19 type ErrGraphQLUser struct { 20 err error 21 queryType, className string 22 } 23 24 func (e ErrGraphQLUser) Error() string { 25 return e.err.Error() 26 } 27 28 func (e ErrGraphQLUser) OriginalError() error { 29 return e.err 30 } 31 32 func (e ErrGraphQLUser) QueryType() string { 33 return e.queryType 34 } 35 36 func (e ErrGraphQLUser) ClassName() string { 37 return e.className 38 } 39 40 func NewErrGraphQLUser(err error, operation, className string) ErrGraphQLUser { 41 return ErrGraphQLUser{err, operation, className} 42 } 43 44 type ErrRateLimit struct { 45 err error 46 } 47 48 func (e ErrRateLimit) Error() string { 49 return e.err.Error() 50 } 51 52 func NewErrRateLimit() ErrRateLimit { 53 return ErrRateLimit{errors.New("429 Too many requests")} 54 } 55 56 type ErrLockConnector struct { 57 err error 58 } 59 60 func (e ErrLockConnector) Error() string { 61 return e.err.Error() 62 } 63 64 func NewErrLockConnector(err error) ErrLockConnector { 65 return ErrLockConnector{fmt.Errorf("could not acquire lock: %w", err)} 66 }