Skip to content

Commit

Permalink
add DUCKDB_INVALID_CONFIGURATION to duckdb.Error (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
apocelipes authored Sep 10, 2024
1 parent 69ef423 commit 61ee2b4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ const (
ErrorTypeMissingExtension // Thrown when an extension is used but not loaded
ErrorTypeAutoLoad // Thrown when an extension is used but not loaded
ErrorTypeSequence
ErrorTypeInvalidConfiguration // An invalid configuration was detected (e.g. a Secret param was missing, or a required setting not found)
)

var errorPrefixMap = map[string]ErrorType{
Expand Down Expand Up @@ -170,6 +171,7 @@ var errorPrefixMap = map[string]ErrorType{
"Missing Extension Error": ErrorTypeMissingExtension,
"Extension Autoloading Error": ErrorTypeAutoLoad,
"Sequence Error": ErrorTypeSequence,
"Invalid Configuration Error": ErrorTypeInvalidConfiguration,
}

type Error struct {
Expand Down
6 changes: 5 additions & 1 deletion errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ func TestGetDuckDBError(t *testing.T) {
Msg: "Error: xxx",
Type: ErrorTypeUnknownType,
},
// next two for the prefix testing
// next 3 cases for the prefix testing
{
Msg: "Invalid Error: xxx",
Type: ErrorTypeInvalid,
Expand All @@ -392,6 +392,10 @@ func TestGetDuckDBError(t *testing.T) {
Msg: "Invalid Input Error: xxx",
Type: ErrorTypeInvalidInput,
},
{
Msg: "Invalid Configuration Error: xxx",
Type: ErrorTypeInvalidConfiguration,
},
}

for _, tc := range testCases {
Expand Down

0 comments on commit 61ee2b4

Please sign in to comment.