Better error handling if file becomes unreadable

Implements #2674
This commit is contained in:
Gina Häußge committed 2018-09-24 16:50:14 +02:00
1 parent 8876ab0ce5
commit 32be5ca87c
1 file changed
+8 -1
+8 -1
View File
@@ -2601,7 +2601,14 @@ class MachineCom(object):
if self._currentFile is None:
return None, None, None
line, pos, lineno = self._currentFile.getNext()
try:
line, pos, lineno = self._currentFile.getNext()
except EnvironmentError:
self._log("There was an error reading from the file that's being printed, cancelling the print. Please "
"consult octoprint.log for details on the error.")
self.cancelPrint()
return None, None, None
if line is None:
if isinstance(self._currentFile, StreamingGcodeFileInformation):
self._finishFileTransfer()