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) | ||||
| 
 | ||||
|                 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 wrapped_required_feature | ||||
|  | @ -86,7 +86,7 @@ def transaction(method): | |||
|         try: | ||||
|             result = method(self, *args, **kwargs) | ||||
|         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) | ||||
|             raise | ||||
| 
 | ||||
|  |  | |||
|  | @ -233,7 +233,7 @@ def hyphen_range(s): | |||
|     elif len(parts) == 2: | ||||
|         (low, high) = parts | ||||
|     else: | ||||
|         raise ValueError('Too many hyphens') | ||||
|         raise ValueError('Too many hyphens.') | ||||
| 
 | ||||
|     low = parse_unit_string(low) | ||||
|     high = parse_unit_string(high) | ||||
|  | @ -406,14 +406,14 @@ def split_easybake_string(ebstring): | |||
|     ebstring = ebstring.strip('.+=') | ||||
| 
 | ||||
|     if ebstring == '': | ||||
|         raise exceptions.EasyBakeError('No tag supplied') | ||||
|         raise exceptions.EasyBakeError('No tag supplied.') | ||||
| 
 | ||||
|     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('=') | ||||
|     if len(rename_parts) > 2: | ||||
|         raise exceptions.EasyBakeError('Too many equals signs') | ||||
|         raise exceptions.EasyBakeError('Too many equals signs.') | ||||
| 
 | ||||
|     if len(rename_parts) == 2: | ||||
|         (ebstring, rename_to) = rename_parts | ||||
|  | @ -423,7 +423,7 @@ def split_easybake_string(ebstring): | |||
| 
 | ||||
|     synonym_parts = ebstring.split('+') | ||||
|     if len(synonym_parts) > 2: | ||||
|         raise exceptions.EasyBakeError('Too many plus signs') | ||||
|         raise exceptions.EasyBakeError('Too many plus signs.') | ||||
| 
 | ||||
|     if len(synonym_parts) == 2: | ||||
|         (tagname, synonym) = synonym_parts | ||||
|  | @ -432,7 +432,7 @@ def split_easybake_string(ebstring): | |||
|         (tagname, synonym) = (synonym_parts[0], None) | ||||
| 
 | ||||
|     if not tagname: | ||||
|         raise exceptions.EasyBakeError('No tag supplied') | ||||
|         raise exceptions.EasyBakeError('No tag supplied.') | ||||
| 
 | ||||
|     tagname = tagname.strip('.') | ||||
|     return (tagname, synonym, rename_to) | ||||
|  | @ -451,7 +451,7 @@ def truthystring(s): | |||
|         return bool(s) | ||||
| 
 | ||||
|     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() | ||||
|     if s in constants.TRUTHYSTRING_TRUE: | ||||
|  |  | |||
|  | @ -254,7 +254,7 @@ class Album(ObjectBase, GroupableMixin): | |||
|             return '' | ||||
| 
 | ||||
|         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() | ||||
| 
 | ||||
|  | @ -266,7 +266,7 @@ class Album(ObjectBase, GroupableMixin): | |||
|             return '' | ||||
| 
 | ||||
|         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() | ||||
|         for whitespace in string.whitespace: | ||||
|  | @ -563,7 +563,7 @@ class Bookmark(ObjectBase): | |||
|             return '' | ||||
| 
 | ||||
|         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() | ||||
|         for whitespace in string.whitespace: | ||||
|  | @ -577,12 +577,12 @@ class Bookmark(ObjectBase): | |||
|             return '' | ||||
| 
 | ||||
|         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() | ||||
| 
 | ||||
|         if not url: | ||||
|             raise ValueError(f'Invalid URL "{url}"') | ||||
|             raise ValueError(f'Invalid URL "{url}".') | ||||
| 
 | ||||
|         return url | ||||
| 
 | ||||
|  | @ -1090,10 +1090,10 @@ class Photo(ObjectBase): | |||
|         self.photodb.log.debug(old_path) | ||||
|         self.photodb.log.debug(new_path) | ||||
|         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: | ||||
|             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() | ||||
| 
 | ||||
|  | @ -1197,7 +1197,7 @@ class Tag(ObjectBase, GroupableMixin): | |||
|             return '' | ||||
| 
 | ||||
|         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() | ||||
| 
 | ||||
|  |  | |||
|  | @ -1291,7 +1291,7 @@ class PDBUserMixin: | |||
| 
 | ||||
|         elif isinstance(user_obj_or_id, objects.User): | ||||
|             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 | ||||
| 
 | ||||
|         elif isinstance(user_obj_or_id, str): | ||||
|  | @ -1299,7 +1299,7 @@ class PDBUserMixin: | |||
|             author_id = self.get_user(id=user_obj_or_id).id | ||||
| 
 | ||||
|         else: | ||||
|             raise TypeError(f'Unworkable type {type(user_obj_or_id)}') | ||||
|             raise TypeError(f'Unworkable type {type(user_obj_or_id)}.') | ||||
| 
 | ||||
|         return author_id | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue