diff --git a/expectations.go b/expectations.go index 5c82c7b..5adf608 100644 --- a/expectations.go +++ b/expectations.go @@ -230,12 +230,13 @@ func (e *ExpectedExec) String() string { } if e.result != nil { - res, _ := e.result.(*result) - msg += "\n - should return Result having:" - msg += fmt.Sprintf("\n LastInsertId: %d", res.insertID) - msg += fmt.Sprintf("\n RowsAffected: %d", res.rowsAffected) - if res.err != nil { - msg += fmt.Sprintf("\n Error: %s", res.err) + if res, ok := e.result.(*result); ok { + msg += "\n - should return Result having:" + msg += fmt.Sprintf("\n LastInsertId: %d", res.insertID) + msg += fmt.Sprintf("\n RowsAffected: %d", res.rowsAffected) + if res.err != nil { + msg += fmt.Sprintf("\n Error: %s", res.err) + } } }