Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
synergy
o3skim
Commits
20287d0f
Commit
20287d0f
authored
Sep 22, 2020
by
BorjaEst
Browse files
Add util return_on_failure to log instead of break
parent
ede8445d
Changes
1
Hide whitespace changes
Inline
Side-by-side
o3skim/utils.py
View file @
20287d0f
...
...
@@ -21,6 +21,20 @@ def cd(newdir):
os
.
chdir
(
prevdir
)
logger
.
debug
(
"Restore directory: '%s'"
,
prevdir
)
def
return_on_failure
(
message
):
"""Decorator to do not break but log"""
def
decorate
(
function
):
def
applicator
(
*
args
,
**
kwargs
):
try
:
function
(
*
args
,
**
kwargs
)
except
:
# Log error with stak using root (not utils)
logging
.
error
(
message
,
exc_info
=
True
)
return
applicator
return
decorate
def
load
(
yaml_file
):
"""Loads the .yaml file with the sources configurations"""
with
open
(
yaml_file
,
"r"
)
as
ymlfile
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment