Skip to content

Commit

Permalink
#5: Fixed usage of raise_from.
Browse files Browse the repository at this point in the history
  • Loading branch information
OOPMan committed Jan 13, 2016
1 parent 59ec25a commit bd78d85
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion rightshift/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def __call__(self, value, **flags):
try:
return self.callable_object(value)
except Exception as e:
raise_from(TransformationException, e)
raise_from(TransformationException(e.message), e)

wrap = Wrap
"""
Expand Down
8 changes: 4 additions & 4 deletions rightshift/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __call__(self, value, **flags):
try:
return value[self.item_or_slice]
except Exception as e:
raise_from(ExtractorException, e)
raise_from(ExtractorException(e.message), e)

def __getattr__(self, item_name):
"""
Expand Down Expand Up @@ -248,7 +248,7 @@ class PatternGroup(Extractor):
A PatternGroup can be called with a string in order to attempt to extract a
new string from that string using a regular expression.
"""
def __init__(self, pattern, group=1, search=True):
def __init__(self, pattern, group=0, search=True):
"""
:param pattern: A string or compiled Regular Expression pattern
:param group: A string or numeric group value
Expand All @@ -271,7 +271,7 @@ def __call__(self, value, **flags):
raise ExtractorException
return match.group(flags.get('pattern_group__group', self.group))
except Exception as e:
raise_from(ExtractorException, e)
raise_from(ExtractorException(e), e)

pattern_group = PatternGroup
"""
Expand Down Expand Up @@ -300,7 +300,7 @@ def __call__(self, value, **flags):
except ExtractorException:
raise
except Exception as e:
raise_from(ExtractorException, e)
raise_from(ExtractorException(e.message), e)
return value

coerce_to = CoerceTo
Expand Down
2 changes: 1 addition & 1 deletion rightshift/matchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def __call__(self, value, **flags):
except Exception as e:
if flags.get('comparison__falsey_exceptions', self.falsey_exceptions):
return False
raise_from(MatcherException, e)
raise_from(MatcherException(e.message), e)
raise NotImplementedError

compare_using = comparison = Comparison
Expand Down

0 comments on commit bd78d85

Please sign in to comment.