Skip to content

Commit

Permalink
More concise index error messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
jshcodes committed Jul 11, 2023
1 parent 13cff19 commit c6b8c1f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/falconpy/_result/_response_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ def get_property(self, item, default_return: Union[str, int, dict, float, list]
if isinstance(self._data, dict):
_returned = self._data.get(item, default_return)
elif isinstance(self._data, (list, str)):
_returned = self._data[item]
try:
_returned = self._data[item]
except IndexError as bad_pos:
raise IndexError(
"Invalid position specified. Please check your index and try again."
) from bad_pos

return _returned

Expand Down

0 comments on commit c6b8c1f

Please sign in to comment.