MCPcopy Create free account
hub / github.com/Permify/permify / IsContextRelatedError

Function IsContextRelatedError

internal/storage/postgres/utils/common.go:147–157  ·  view source on GitHub ↗

IsContextRelatedError checks if the error is due to context cancellation, deadline exceedance, or closed connection

(ctx context.Context, err error)

Source from the content-addressed store, hash-verified

145
146// IsContextRelatedError checks if the error is due to context cancellation, deadline exceedance, or closed connection
147func IsContextRelatedError(ctx context.Context, err error) bool {
148 if errors.Is(ctx.Err(), context.Canceled) || errors.Is(ctx.Err(), context.DeadlineExceeded) {
149 return true
150 }
151 if errors.Is(err, context.Canceled) ||
152 errors.Is(err, context.DeadlineExceeded) ||
153 strings.Contains(err.Error(), "conn closed") {
154 return true
155 }
156 return false
157}
158
159// IsSerializationRelatedError checks if the error is a serialization failure, typically in database transactions.
160func IsSerializationRelatedError(err error) bool {

Callers 2

common_test.goFile · 0.92
HandleErrorFunction · 0.70

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected