Skip to content

Commit e41f83d

Browse files
Simplify error message and remove redundant test code
Co-authored-by: dlevy-msft-sql <[email protected]>
1 parent 3c1d71b commit e41f83d

2 files changed

Lines changed: 1 addition & 8 deletions

File tree

pkg/sqlcmd/sqlcmd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ func safeColumnTypes(rows *sql.Rows) (cols []*sql.ColumnType, err error) {
420420
defer func() {
421421
if r := recover(); r != nil {
422422
// Convert panic to error
423-
err = fmt.Errorf("failed to get column types: %v (this may be due to unsupported data types like GEOGRAPHY or GEOMETRY)", r)
423+
err = fmt.Errorf("failed to get column types: %v", r)
424424
cols = nil
425425
}
426426
}()

pkg/sqlcmd/sqlcmd_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -719,13 +719,6 @@ func TestSqlcmdPrefersSharedMemoryProtocol(t *testing.T) {
719719
// wrapper ensures this panic is caught regardless of where in the ColumnTypes()
720720
// call stack it originates.
721721
func TestSafeColumnTypesHandlesPanic(t *testing.T) {
722-
// Verify that the defer/recover mechanism works by triggering any panic
723-
defer func() {
724-
if r := recover(); r != nil {
725-
t.Errorf("safeColumnTypes should not panic, but got: %v", r)
726-
}
727-
}()
728-
729722
// This will trigger a panic due to nil pointer, but safeColumnTypes should catch it
730723
var rows *sql.Rows
731724
cols, err := safeColumnTypes(rows)

0 commit comments

Comments
 (0)