Example_customHints demonstrates adding custom hints
()
| 137 | |
| 138 | // Example_customHints demonstrates adding custom hints |
| 139 | func 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 |
| 156 | func Example_multipleErrors() { |
nothing calls this directly
no test coverage detected