Commit 20287d0f authored by BorjaEst's avatar BorjaEst
Browse files

Add util return_on_failure to log instead of break

parent ede8445d
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment