Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #24 from Den4200/error-handling
Browse files Browse the repository at this point in the history
Error handling yay!
  • Loading branch information
Den4200 authored Feb 13, 2023
2 parents f81dfd7 + 40f3960 commit 656b186
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "tungsten-sds"
version = "0.6.0"
version = "0.6.1"
description = "An MSDS parser."
authors = ["Dennis Pham <dennis@dennispham.me>", "Brian Lu <me@greencappuccino.net>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion tungsten/parsers/field_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def getField(self, field: SdsQueryFieldName, target: dict):
target = command.match(target)
try:
result = post_process(target)
except (KeyError, AttributeError):
except (KeyError, AttributeError, TypeError, IndexError):
result = None
return result

Expand Down
5 changes: 4 additions & 1 deletion tungsten/parsers/supplier/sigma_aldrich/table_injector.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ def generate_injections(self, io: IO[bytes]) -> list[Injection]:
def reject_table(table: TabulaTable) -> bool:
# TODO this is a temporary solution
# TODO reject more tables that are false positives
return table.data[1][0].text.strip()[1] == ")"
try:
return table.data[1][0].text.strip()[1] == ")"
except IndexError:
return True


@dataclass
Expand Down

0 comments on commit 656b186

Please sign in to comment.