MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / WrapError

Function WrapError

pkg/errors/builders.go:220–222  ·  view source on GitHub ↗

WrapError creates a structured error that wraps an existing cause error. Use this to add error code, location, and SQL context to low-level errors (e.g., I/O errors, unexpected runtime panics) so they integrate with the GoSQLX error handling pipeline. Parameters: - code: ErrorCode classifying the e

(code ErrorCode, message string, location models.Location, sql string, cause error)

Source from the content-addressed store, hash-verified

218// - sql: Full SQL source used to generate visual context
219// - cause: Underlying error being wrapped (accessible via errors.Is / errors.As)
220func WrapError(code ErrorCode, message string, location models.Location, sql string, cause error) *Error {
221 return NewError(code, message, location).WithContext(sql, 1).WithCause(cause)
222}
223
224// Tokenizer DoS Protection Errors (E1006-E1008)
225

Callers 3

Example_errorChainingFunction · 0.92
Example_chainedErrorsFunction · 0.92
TestWrapErrorFunction · 0.85

Calls 3

WithCauseMethod · 0.80
NewErrorFunction · 0.70
WithContextMethod · 0.45

Tested by 3

Example_errorChainingFunction · 0.74
Example_chainedErrorsFunction · 0.74
TestWrapErrorFunction · 0.68