Skip to content

Commit

Permalink
🐛 fix #42: Errors should never pass silently
Browse files Browse the repository at this point in the history
  • Loading branch information
chfw committed Aug 6, 2017
1 parent c2859d1 commit a94f937
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pyexcel_io/book.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ def write(self, incoming_dict):
if sheet_writer:
sheet_writer.write_array(incoming_dict[sheet_name])
sheet_writer.close()
else:
raise Exception("Cannot create a sheet writer!")

def create_sheet(self, sheet_name):
"""
Expand Down
2 changes: 2 additions & 0 deletions pyexcel_io/database/importers/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,6 @@ def create_sheet(self, sheet_name):
self.__importer, adapter,
auto_commit=self.__auto_commit
)
else:
raise Exception("No suitable database adapter found!")
return sheet_writer
1 change: 1 addition & 0 deletions tests/test_django_book.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ def test_reading_from_more_models(self):
data[key] = list(data[key])
assert data == self.content

@raises(Exception)
def test_special_case_where_only_one_model_used(self):
model1 = FakeDjangoModel()
importer = DjangoModelImporter()
Expand Down

0 comments on commit a94f937

Please sign in to comment.