Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
satella
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
satella
Commits
899da93e
Commit
899da93e
authored
7 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
b6a011cc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
satella/coding/recast_exceptions.py
+2
-2
2 additions, 2 deletions
satella/coding/recast_exceptions.py
tests/test_coding/test_rethrow.py
+4
-0
4 additions, 0 deletions
tests/test_coding/test_rethrow.py
with
6 additions
and
2 deletions
satella/coding/recast_exceptions.py
+
2
−
2
View file @
899da93e
...
...
@@ -19,10 +19,10 @@ def silence_excs(*exc_types):
class
rethrow_as
(
object
):
"""
Decorator + context manager
"""
def
__init__
(
self
,
*
pairs
,
exception_preprocessor
=
repr
):
def
__init__
(
self
,
*
pairs
,
**
kwargs
):
self
.
to_catch
=
tuple
(
p
[
0
]
for
p
in
pairs
)
self
.
pairs
=
pairs
self
.
exception_preprocessor
=
exception_preprocessor
self
.
exception_preprocessor
=
kwargs
.
get
(
'
exception_preprocessor
'
,
repr
)
def
__call__
(
self
,
fun
):
@functools.wraps
(
fun
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_coding/test_rethrow.py
+
4
−
0
View file @
899da93e
...
...
@@ -7,6 +7,10 @@ from satella.coding import rethrow_as, silence_excs
class
TestStuff
(
unittest
.
TestCase
):
@silence_excs
(
ValueError
)
def
test_silencer_2
(
self
):
raise
ValueError
()
def
test_silencer
(
self
):
with
silence_excs
(
TypeError
):
raise
TypeError
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment