Cleaned up some batchprocessor error handling.
This commit is contained in:
parent
e399c418e5
commit
8ad2c18524
1 changed files with 13 additions and 9 deletions
|
|
@ -47,7 +47,7 @@ _UTF8_ERROR = \
|
||||||
documentation of your text editor on how to do this, or switch to a
|
documentation of your text editor on how to do this, or switch to a
|
||||||
better featured one) and try again.
|
better featured one) and try again.
|
||||||
|
|
||||||
The (first) error was found with a character on line %s in the file.
|
Error reported was: '%s'
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_PROCPOOL_BATCHCMD_SOURCE = """
|
_PROCPOOL_BATCHCMD_SOURCE = """
|
||||||
|
|
@ -244,15 +244,17 @@ class CmdBatchCommands(MuxCommand):
|
||||||
try:
|
try:
|
||||||
commands = BATCHCMD.parse_file(python_path)
|
commands = BATCHCMD.parse_file(python_path)
|
||||||
except UnicodeDecodeError, err:
|
except UnicodeDecodeError, err:
|
||||||
lnum = err.linenum
|
caller.msg(_UTF8_ERROR % (python_path, err))
|
||||||
caller.msg(_UTF8_ERROR % (python_path, lnum))
|
|
||||||
return
|
return
|
||||||
|
except IOError:
|
||||||
if not commands:
|
|
||||||
string = "'%s' not found.\nYou have to supply the python path "
|
string = "'%s' not found.\nYou have to supply the python path "
|
||||||
string += "of the file relative to \none of your batch-file directories (%s)."
|
string += "of the file relative to \none of your batch-file directories (%s)."
|
||||||
caller.msg(string % (python_path, ", ".join(settings.BASE_BATCHPROCESS_PATHS)))
|
caller.msg(string % (python_path, ", ".join(settings.BASE_BATCHPROCESS_PATHS)))
|
||||||
return
|
return
|
||||||
|
if not commands:
|
||||||
|
caller.msg("File %s seems empty of valid commands." % python_path)
|
||||||
|
return
|
||||||
|
|
||||||
switches = self.switches
|
switches = self.switches
|
||||||
|
|
||||||
# Store work data in cache
|
# Store work data in cache
|
||||||
|
|
@ -349,15 +351,17 @@ class CmdBatchCode(MuxCommand):
|
||||||
try:
|
try:
|
||||||
codes = BATCHCODE.parse_file(python_path, debug=debug)
|
codes = BATCHCODE.parse_file(python_path, debug=debug)
|
||||||
except UnicodeDecodeError, err:
|
except UnicodeDecodeError, err:
|
||||||
lnum = err.linenum
|
caller.msg(_UTF8_ERROR % (python_path, err))
|
||||||
caller.msg(_UTF8_ERROR % (python_path, lnum))
|
|
||||||
return
|
return
|
||||||
|
except IOError:
|
||||||
if not codes:
|
|
||||||
string = "'%s' not found.\nYou have to supply the python path "
|
string = "'%s' not found.\nYou have to supply the python path "
|
||||||
string += "of the file relative to \nyour batch-file directories (%s)."
|
string += "of the file relative to \nyour batch-file directories (%s)."
|
||||||
caller.msg(string % (python_path, ", ".join(settings.BASE_BATCHPROCESS_PATHS)))
|
caller.msg(string % (python_path, ", ".join(settings.BASE_BATCHPROCESS_PATHS)))
|
||||||
return
|
return
|
||||||
|
if not codes:
|
||||||
|
caller.msg("File %s seems empty of functional code." % python_path)
|
||||||
|
return
|
||||||
|
|
||||||
switches = self.switches
|
switches = self.switches
|
||||||
|
|
||||||
# Store work data in cache
|
# Store work data in cache
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue