Example_enhancedErrorWithContext demonstrates the enhanced error formatting with 3 lines of context
()
| 23 | |
| 24 | // Example_enhancedErrorWithContext demonstrates the enhanced error formatting with 3 lines of context |
| 25 | func Example_enhancedErrorWithContext() { |
| 26 | // Multi-line SQL with an error on line 3 |
| 27 | sql := `SELECT id, name, email |
| 28 | FROM users |
| 29 | WHERE age > 18.45.6 |
| 30 | ORDER BY name` |
| 31 | |
| 32 | location := models.Location{Line: 3, Column: 13} |
| 33 | err := errors.InvalidNumberError("18.45.6", location, sql) |
| 34 | |
| 35 | fmt.Println("Enhanced Error Output:") |
| 36 | fmt.Println(err.Error()) |
| 37 | fmt.Println() |
| 38 | |
| 39 | // Note: This will show: |
| 40 | // - Line 2 (FROM users) |
| 41 | // - Line 3 (WHERE age > 18.45.6) with error indicator |
| 42 | // - Line 4 (ORDER BY name) |
| 43 | } |
| 44 | |
| 45 | // Example_typoDetectionWithSuggestions demonstrates automatic typo detection |
| 46 | func Example_typoDetectionWithSuggestions() { |
nothing calls this directly
no test coverage detected