gorqlite
gorqlite copied to clipboard
feature request: typed error instead of fmt.Errorf("there were %d statement errors", numStatementErrors)
When I'm writing SQL, sometimes, I don't get it right. However, the error I get back just tells me that somewhere, there's a problem: https://github.com/rqlite/gorqlite/blob/12ae7d03ef19e6005d0cff82c6bf74000ea69e43/query.go#L307-L309
There's no additional context available to me - for example, which statement out of the multiple statements it is, or where exactly in the SQL the problem is.
Mostly, I want this, because it prints out a useful message like: no such table: embeddings
rather than there were 1 statement errors
, which doesn't tell me what the problem is.
results, err := q.conn.WriteParameterizedContext(ctx, statements)
if err != nil {
var errs []error
for _, result := range results {
errs = append(errs, result.Err)
}
return errors.Join(errs...)
}
Perhaps it could be possible for the WriteParameterizedContext
etc. methods to return an error which is a type that contains a list of all the errors, and incorporates them into the result of the Error() string
?