NewError creates a new structured error. Factory function for creating GoSQLX errors with error code, message, and location. This is the primary way to create errors in the library. Parameters: - code: ErrorCode for programmatic error handling (E1xxx-E4xxx) - message: Human-readable error descript
(code ErrorCode, message string, location models.Location)
| 333 | // |
| 334 | // err = err.WithContext(sqlSource, 1).WithHint("Expected FROM keyword") |
| 335 | func NewError(code ErrorCode, message string, location models.Location) *Error { |
| 336 | return &Error{ |
| 337 | Code: code, |
| 338 | Message: message, |
| 339 | Location: location, |
| 340 | HelpURL: fmt.Sprintf("https://github.com/ajitpratap0/GoSQLX/blob/main/docs/ERROR_CODES.md#%s", code), |
| 341 | } |
| 342 | } |
| 343 | |
| 344 | // WithContext adds SQL context to the error. |
| 345 | // |
no outgoing calls