Skip to content

Commit

Permalink
Update some logger messages to be more descriptive
Browse files Browse the repository at this point in the history
  • Loading branch information
Sofia Margariti committed Oct 31, 2017
1 parent cde8a82 commit f72d49f
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions txclib/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,9 @@ def get_resource_lang_mapping(self, resource):
except configparser.NoOptionError:
pass
except (ValueError, KeyError):
raise Exception("Your lang map configuration is not correct.")
raise Exception(
"Your lang map configuration is not correct."
"Check that there are no duplicate keys or values.")

if self.config.has_section(resource):
res_lang_map = Flipdict()
Expand All @@ -312,7 +314,9 @@ def get_resource_lang_mapping(self, resource):
except configparser.NoOptionError:
pass
except (ValueError, KeyError):
raise Exception("Your lang map configuration is not correct.")
raise Exception(
"Your lang map configuration is not correct."
"Check that there are no duplicate keys or values.")

# merge the lang maps and return result
lang_map.update(res_lang_map)
Expand Down Expand Up @@ -688,7 +692,7 @@ def push(self, source=False, translations=False, force=False,
logger.debug("Using host %s" % host)
self._set_url_info(host=host, project=project_slug,
resource=resource_slug)
logger.info("Pushing translations for resource %s:" % resource)
logger.info("Pushing resource %s:" % resource)

stats = self._get_stats_for_resource()

Expand All @@ -711,7 +715,7 @@ def push(self, source=False, translations=False, force=False,
continue
# Push source file
try:
logger.warning("Pushing source file (%s)" % sfile)
logger.info("Pushing source file (%s)" % sfile)
if not self._resource_exists(stats):
logger.info("Resource does not exist. Creating...")
fileinfo = "%s;%s" % (resource_slug, slang)
Expand All @@ -727,7 +731,12 @@ def push(self, source=False, translations=False, force=False,
params=params,
)
except Exception as e:
if isinstance(e, SSLError) or not skip:
if isinstance(e, SSLError):
raise
elif not skip:
logger.error("Could not upload source file. "
"You can use --skip to ignore this "
"error and continue the execution.")
raise
else:
logger.error(e)
Expand Down Expand Up @@ -805,7 +814,12 @@ def push(self, source=False, translations=False, force=False,
logger.error("Resource hasn't been created. "
"Try pushing source file.")
except Exception as e:
if isinstance(e, SSLError) or not skip:
if isinstance(e, SSLError):
raise
elif not skip:
logger.error("Could not push translations. "
"You can use --skip to ignore this "
"error and continue the execution.")
raise
else:
logger.error(e)
Expand Down

0 comments on commit f72d49f

Please sign in to comment.