Fix error message when invalid format is given
This commit is contained in:
parent
4477a56810
commit
234d43cc01
@ -754,10 +754,16 @@ def ReadComments(input_files, input_format, font_size=25.0, progress_callback=No
|
|||||||
str_io = io.StringIO(s)
|
str_io = io.StringIO(s)
|
||||||
if input_format == 'autodetect':
|
if input_format == 'autodetect':
|
||||||
CommentProcessor = GetCommentProcessor(str_io)
|
CommentProcessor = GetCommentProcessor(str_io)
|
||||||
|
if not CommentProcessor:
|
||||||
|
raise ValueError(
|
||||||
|
_('Failed to detect comment file format: %s') % i
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
CommentProcessor = CommentFormatMap.get(input_format)
|
CommentProcessor = CommentFormatMap.get(input_format)
|
||||||
if not CommentProcessor:
|
if not CommentProcessor:
|
||||||
raise ValueError(_('Unknown comment file format: %s') % i)
|
raise ValueError(
|
||||||
|
_('Unknown comment file format: %s') % input_format
|
||||||
|
)
|
||||||
comments.extend(CommentProcessor(FilterBadChars(str_io), font_size))
|
comments.extend(CommentProcessor(FilterBadChars(str_io), font_size))
|
||||||
if progress_callback:
|
if progress_callback:
|
||||||
progress_callback(len(input_files), len(input_files))
|
progress_callback(len(input_files), len(input_files))
|
||||||
|
Loading…
Reference in New Issue
Block a user