Skip to content

Commit

Permalink
better error handling in iterutils.get_path
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmoud committed Feb 9, 2016
1 parent 6d186bf commit 4c5e39f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions boltons/iterutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,13 +846,13 @@ def get_path(root, path, default=_UNSET):
cur = cur[seg]
except (KeyError, IndexError) as exc:
raise PathAccessError(exc, seg, path)
except TypeError:
except TypeError as exc:
# either string index in a list, or a parent that
# doesn't support indexing
try:
seg = int(seg)
cur = cur[seg]
except (KeyError, IndexError, TypeError):
except (ValueError, KeyError, IndexError, TypeError):
raise PathAccessError(exc, seg, path)
return cur

Expand Down

0 comments on commit 4c5e39f

Please sign in to comment.