Skip to content

Commit 0cca47c

Browse files
author
Melvyn Sopacua
committed
fix(1.11): Use the correct exception
1 parent 74af346 commit 0cca47c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sql_server/pyodbc/base.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,14 +606,16 @@ def fetchone(self):
606606
def fetchmany(self, chunk):
607607
try:
608608
return self.format_rows(self.cursor.fetchmany(chunk))
609-
except ProgrammingError:
609+
except (ProgrammingError, Database.Error):
610610
return []
611611

612612
def fetchall(self):
613613
try:
614-
return self.format_rows(self.cursor.fetchall())
615-
except ProgrammingError:
614+
rows = self.cursor.fetchall()
615+
except (ProgrammingError, Database.Error):
616616
return []
617+
else:
618+
return self.format_rows(rows)
617619

618620
def __getattr__(self, attr):
619621
if attr in self.__dict__:

0 commit comments

Comments
 (0)