MCPcopy Create free account
hub / github.com/tmc/langchaingo / Is

Method Is

llms/errors.go:82–101  ·  view source on GitHub ↗

Is implements errors.Is support.

(target error)

Source from the content-addressed store, hash-verified

80
81// Is implements errors.Is support.
82func (e *Error) Is(target error) bool {
83 if target == nil {
84 return false
85 }
86
87 // Check if target is an *Error with the same code
88 if te, ok := target.(*Error); ok {
89 return e.Code == te.Code
90 }
91
92 // Check against common errors
93 switch e.Code {
94 case ErrCodeCanceled:
95 return errors.Is(target, context.Canceled)
96 case ErrCodeTimeout:
97 return errors.Is(target, context.DeadlineExceeded)
98 }
99
100 return false
101}
102
103// NewError creates a new standardized error.
104func NewError(code ErrorCode, provider, message string) *Error {

Callers 15

TestCombineFunction · 0.80
CallMethod · 0.80
TestFunction · 0.80
TestFunction · 0.80
TestFunction · 0.80
CallMethod · 0.80
performSearchMethod · 0.80
findSimilarMethod · 0.80
getContentsMethod · 0.80
CallMethod · 0.80
CallMethod · 0.80
CallMethod · 0.80

Calls

no outgoing calls

Tested by 11

TestCombineFunction · 0.64
TestFunction · 0.64
TestFunction · 0.64
TestFunction · 0.64
TestErrorIsFunction · 0.64
TestErrorMapperFunction · 0.64
TestCreateEmbeddingFunction · 0.64
TestCheckValidTemplateFunction · 0.64
TestRenderTemplateFunction · 0.64
TestRenderTemplateFSFunction · 0.64