Skip to content

Commit 3ccee33

Browse files
committed
returning errors instead of nil
1 parent 16cc4e9 commit 3ccee33

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/dinosql/parser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ func parseQuery(c core.Catalog, stmt nodes.Node, source string) (*Query, error)
371371
}
372372
raw, ok := stmt.(nodes.RawStmt)
373373
if !ok {
374-
return nil, nil
374+
return nil, errors.New("node is not a statement")
375375
}
376376
switch n := raw.Stmt.(type) {
377377
case nodes.SelectStmt:
@@ -382,7 +382,7 @@ func parseQuery(c core.Catalog, stmt nodes.Node, source string) (*Query, error)
382382
}
383383
case nodes.UpdateStmt:
384384
default:
385-
return nil, nil
385+
return nil, fmt.Errorf("parseQuery: unsupported statement type: %T", n)
386386
}
387387

388388
rawSQL, err := pluckQuery(source, raw)

0 commit comments

Comments
 (0)