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

Function Example_customHints

pkg/errors/example_test.go:139–153  ·  view source on GitHub ↗

Example_customHints demonstrates adding custom hints

()

Source from the content-addressed store, hash-verified

137
138// Example_customHints demonstrates adding custom hints
139func Example_customHints() {
140 sql := "SELECT * FROM users WHERE"
141 location := models.Location{Line: 1, Column: 27}
142
143 err := errors.NewError(
144 errors.ErrCodeIncompleteStatement,
145 "incomplete WHERE clause",
146 location,
147 )
148 err.WithContext(sql, 5)
149 err.WithHint("Add a condition after WHERE, e.g., WHERE age > 18")
150
151 // Error now includes custom context and hint
152 _ = err
153}
154
155// Example_multipleErrors demonstrates handling multiple validation errors
156func Example_multipleErrors() {

Callers

nothing calls this directly

Calls 3

WithContextMethod · 0.95
WithHintMethod · 0.95
NewErrorFunction · 0.92

Tested by

no test coverage detected