2
0

Rows.Scan errors now include which argument caused error

This commit is contained in:
Jack Christensen
2015-11-20 14:02:49 -06:00
parent dd26ad0091
commit edfdaf15c6
4 changed files with 23 additions and 7 deletions
+1 -2
View File
@@ -1,7 +1,6 @@
package pgx_test
import (
"encoding/json"
"github.com/jackc/pgx"
"net"
"reflect"
@@ -196,7 +195,7 @@ func testJsonInt16ArrayFailureDueToOverflow(t *testing.T, conn *pgx.Conn, typena
input := []int{1, 2, 234432}
var output []int16
err := conn.QueryRow("select $1::"+typename, input).Scan(&output)
if _, ok := err.(*json.UnmarshalTypeError); !ok {
if err.Error() != "can't scan into dest[0]: json: cannot unmarshal number 234432 into Go value of type int16" {
t.Errorf("%s: Expected *json.UnmarkalTypeError, but got %v", typename, err)
}
}