-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump Go version, unify errors and other refactoring (#187)
* started unifying errors * nits * trying to fix linter run failure by bumping the go version * %w instead of %s * fix more than one error-wrapping directive * run gofumpt, bump go version everywhere * fix freebsd run * trigger tests * battling CI * revert to 1.21 * revert conn changes * revert comment changes * nit
- Loading branch information
1 parent
9c6cfe2
commit e4e08e9
Showing
13 changed files
with
120 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package duckdb | ||
|
||
import "C" | ||
import ( | ||
"errors" | ||
"fmt" | ||
) | ||
|
||
func getError(errDriver error, err error) error { | ||
if err == nil { | ||
return fmt.Errorf("%s: %w", driverErrMsg, errDriver) | ||
} | ||
return fmt.Errorf("%s: %w: %s", driverErrMsg, errDriver, err.Error()) | ||
} | ||
|
||
func getDuckDBError(err *C.char) error { | ||
return errors.New(C.GoString(err)) | ||
} | ||
|
||
const driverErrMsg = "database/sql/driver" | ||
|
||
var ( | ||
errParseDSN = errors.New("could not parse DSN for database") | ||
errOpen = errors.New("could not open database") | ||
errSetConfig = errors.New("could not set invalid or local option for global database config") | ||
|
||
// Errors not covered in tests. | ||
errConnect = errors.New("could not connect to database") | ||
errCreateConfig = errors.New("could not create config for database") | ||
) |
Oops, something went wrong.