Catch exceptions when checking if a file is a project

This commit is contained in:
Lipu Fei 2017-03-30 19:08:17 +02:00
parent 0c6d0a0abb
commit c74ff4b204

View file

@ -1242,6 +1242,7 @@ class CuraApplication(QtApplication):
"""
Checks if the given file URL is a valid project file.
"""
try:
file_path = QUrl(file_url).toLocalFile()
workspace_reader = self.getWorkspaceFileHandler().getReaderForFile(file_path)
if workspace_reader is None:
@ -1249,3 +1250,6 @@ class CuraApplication(QtApplication):
result = workspace_reader.preRead(file_path, show_dialog=False)
return result == WorkspaceReader.PreReadResult.accepted
except Exception as e:
Logger.log("e", "Could not check file %s: %s", file_url, e)
return False