Add period to all exception messages.
This commit is contained in:
parent
06c811d858
commit
7b7015125e
4 changed files with 19 additions and 19 deletions
|
@ -42,7 +42,7 @@ def required_feature(features):
|
||||||
raise exceptions.FeatureDisabled(feature)
|
raise exceptions.FeatureDisabled(feature)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise ValueError(f'Bad required_feature: "{feature}" led to {cfg}')
|
raise ValueError(f'Bad required_feature: "{feature}" led to {cfg}.')
|
||||||
|
|
||||||
return method(self, *args, **kwargs)
|
return method(self, *args, **kwargs)
|
||||||
return wrapped_required_feature
|
return wrapped_required_feature
|
||||||
|
@ -86,7 +86,7 @@ def transaction(method):
|
||||||
try:
|
try:
|
||||||
result = method(self, *args, **kwargs)
|
result = method(self, *args, **kwargs)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
photodb.log.debug(f'{method} raised {repr(exc)}')
|
photodb.log.debug(f'{method} raised {repr(exc)}.')
|
||||||
photodb.rollback(savepoint=savepoint_id)
|
photodb.rollback(savepoint=savepoint_id)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
|
@ -233,7 +233,7 @@ def hyphen_range(s):
|
||||||
elif len(parts) == 2:
|
elif len(parts) == 2:
|
||||||
(low, high) = parts
|
(low, high) = parts
|
||||||
else:
|
else:
|
||||||
raise ValueError('Too many hyphens')
|
raise ValueError('Too many hyphens.')
|
||||||
|
|
||||||
low = parse_unit_string(low)
|
low = parse_unit_string(low)
|
||||||
high = parse_unit_string(high)
|
high = parse_unit_string(high)
|
||||||
|
@ -406,14 +406,14 @@ def split_easybake_string(ebstring):
|
||||||
ebstring = ebstring.strip('.+=')
|
ebstring = ebstring.strip('.+=')
|
||||||
|
|
||||||
if ebstring == '':
|
if ebstring == '':
|
||||||
raise exceptions.EasyBakeError('No tag supplied')
|
raise exceptions.EasyBakeError('No tag supplied.')
|
||||||
|
|
||||||
if '=' in ebstring and '+' in ebstring:
|
if '=' in ebstring and '+' in ebstring:
|
||||||
raise exceptions.EasyBakeError('Cannot rename and assign snynonym at once')
|
raise exceptions.EasyBakeError('Cannot rename and assign snynonym at once.')
|
||||||
|
|
||||||
rename_parts = ebstring.split('=')
|
rename_parts = ebstring.split('=')
|
||||||
if len(rename_parts) > 2:
|
if len(rename_parts) > 2:
|
||||||
raise exceptions.EasyBakeError('Too many equals signs')
|
raise exceptions.EasyBakeError('Too many equals signs.')
|
||||||
|
|
||||||
if len(rename_parts) == 2:
|
if len(rename_parts) == 2:
|
||||||
(ebstring, rename_to) = rename_parts
|
(ebstring, rename_to) = rename_parts
|
||||||
|
@ -423,7 +423,7 @@ def split_easybake_string(ebstring):
|
||||||
|
|
||||||
synonym_parts = ebstring.split('+')
|
synonym_parts = ebstring.split('+')
|
||||||
if len(synonym_parts) > 2:
|
if len(synonym_parts) > 2:
|
||||||
raise exceptions.EasyBakeError('Too many plus signs')
|
raise exceptions.EasyBakeError('Too many plus signs.')
|
||||||
|
|
||||||
if len(synonym_parts) == 2:
|
if len(synonym_parts) == 2:
|
||||||
(tagname, synonym) = synonym_parts
|
(tagname, synonym) = synonym_parts
|
||||||
|
@ -432,7 +432,7 @@ def split_easybake_string(ebstring):
|
||||||
(tagname, synonym) = (synonym_parts[0], None)
|
(tagname, synonym) = (synonym_parts[0], None)
|
||||||
|
|
||||||
if not tagname:
|
if not tagname:
|
||||||
raise exceptions.EasyBakeError('No tag supplied')
|
raise exceptions.EasyBakeError('No tag supplied.')
|
||||||
|
|
||||||
tagname = tagname.strip('.')
|
tagname = tagname.strip('.')
|
||||||
return (tagname, synonym, rename_to)
|
return (tagname, synonym, rename_to)
|
||||||
|
@ -451,7 +451,7 @@ def truthystring(s):
|
||||||
return bool(s)
|
return bool(s)
|
||||||
|
|
||||||
if not isinstance(s, str):
|
if not isinstance(s, str):
|
||||||
raise TypeError(f'Unsupported type {type(s)}')
|
raise TypeError(f'String should be {bool}, {int}, {str}, or None, not {type(s)}.')
|
||||||
|
|
||||||
s = s.lower()
|
s = s.lower()
|
||||||
if s in constants.TRUTHYSTRING_TRUE:
|
if s in constants.TRUTHYSTRING_TRUE:
|
||||||
|
|
|
@ -254,7 +254,7 @@ class Album(ObjectBase, GroupableMixin):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
if not isinstance(description, str):
|
if not isinstance(description, str):
|
||||||
raise TypeError(f'Description must be string, not {type(description)}')
|
raise TypeError(f'Description must be {str}, not {type(description)}.')
|
||||||
|
|
||||||
description = description.strip()
|
description = description.strip()
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ class Album(ObjectBase, GroupableMixin):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
if not isinstance(title, str):
|
if not isinstance(title, str):
|
||||||
raise TypeError(f'Title must be string, not {type(title)}')
|
raise TypeError(f'Title must be {str}, not {type(title)}.')
|
||||||
|
|
||||||
title = title.strip()
|
title = title.strip()
|
||||||
for whitespace in string.whitespace:
|
for whitespace in string.whitespace:
|
||||||
|
@ -563,7 +563,7 @@ class Bookmark(ObjectBase):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
if not isinstance(title, str):
|
if not isinstance(title, str):
|
||||||
raise TypeError(f'Title must be string, not {type(title)}')
|
raise TypeError(f'Title must be {str}, not {type(title)}.')
|
||||||
|
|
||||||
title = title.strip()
|
title = title.strip()
|
||||||
for whitespace in string.whitespace:
|
for whitespace in string.whitespace:
|
||||||
|
@ -577,12 +577,12 @@ class Bookmark(ObjectBase):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
if not isinstance(url, str):
|
if not isinstance(url, str):
|
||||||
raise TypeError(f'URL must be string, not {type(url)}')
|
raise TypeError(f'URL must be {str}, not {type(url)}.')
|
||||||
|
|
||||||
url = url.strip()
|
url = url.strip()
|
||||||
|
|
||||||
if not url:
|
if not url:
|
||||||
raise ValueError(f'Invalid URL "{url}"')
|
raise ValueError(f'Invalid URL "{url}".')
|
||||||
|
|
||||||
return url
|
return url
|
||||||
|
|
||||||
|
@ -1090,10 +1090,10 @@ class Photo(ObjectBase):
|
||||||
self.photodb.log.debug(old_path)
|
self.photodb.log.debug(old_path)
|
||||||
self.photodb.log.debug(new_path)
|
self.photodb.log.debug(new_path)
|
||||||
if (new_path.parent != old_path.parent) and not move:
|
if (new_path.parent != old_path.parent) and not move:
|
||||||
raise ValueError('Cannot move the file without param move=True')
|
raise ValueError('Cannot move the file without param move=True.')
|
||||||
|
|
||||||
if new_path.absolute_path == old_path.absolute_path:
|
if new_path.absolute_path == old_path.absolute_path:
|
||||||
raise ValueError('The new and old names are the same')
|
raise ValueError('The new and old names are the same.')
|
||||||
|
|
||||||
new_path.assert_not_exists()
|
new_path.assert_not_exists()
|
||||||
|
|
||||||
|
@ -1197,7 +1197,7 @@ class Tag(ObjectBase, GroupableMixin):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
if not isinstance(description, str):
|
if not isinstance(description, str):
|
||||||
raise TypeError(f'Description must be string, not {type(description)}')
|
raise TypeError(f'Description must be {str}, not {type(description)}.')
|
||||||
|
|
||||||
description = description.strip()
|
description = description.strip()
|
||||||
|
|
||||||
|
|
|
@ -1291,7 +1291,7 @@ class PDBUserMixin:
|
||||||
|
|
||||||
elif isinstance(user_obj_or_id, objects.User):
|
elif isinstance(user_obj_or_id, objects.User):
|
||||||
if user_obj_or_id.photodb != self:
|
if user_obj_or_id.photodb != self:
|
||||||
raise ValueError('That user does not belong to this photodb')
|
raise ValueError('That user does not belong to this photodb.')
|
||||||
author_id = user_obj_or_id.id
|
author_id = user_obj_or_id.id
|
||||||
|
|
||||||
elif isinstance(user_obj_or_id, str):
|
elif isinstance(user_obj_or_id, str):
|
||||||
|
@ -1299,7 +1299,7 @@ class PDBUserMixin:
|
||||||
author_id = self.get_user(id=user_obj_or_id).id
|
author_id = self.get_user(id=user_obj_or_id).id
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise TypeError(f'Unworkable type {type(user_obj_or_id)}')
|
raise TypeError(f'Unworkable type {type(user_obj_or_id)}.')
|
||||||
|
|
||||||
return author_id
|
return author_id
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue