Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit b29a0ead authored by Harald Martini's avatar Harald Martini
Browse files

Return Task.FromException instead of null in JobListViewModel

parent 5e3a040c
No related branches found
No related tags found
No related merge requests found
......@@ -267,14 +267,10 @@ namespace VECTO3GUI2020.ViewModel.Implementation
try {
var inputData = JSONInputDataFactory.ReadJsonJob(fileName, true);
return Task.FromResult(_multiStageViewModelFactory.CreateDocumentViewModel(inputData));
} catch (Exception ex) {
throw new VectoException($"File {fileName} not supported", ex);
return Task.FromException<IDocumentViewModel>(ex);
//_dialogHelper.ShowErrorMessage(ex.Message));
}
return null;
}
private Task<IDocumentViewModel> LoadXMLFile([NotNull] string fileName)
......@@ -304,9 +300,10 @@ namespace VECTO3GUI2020.ViewModel.Implementation
}
return Task.FromResult(result);
}
else
{
throw new VectoXMLException($"{documentType.ToString()} not supported");
else {
return Task.FromException<IDocumentViewModel>(
new VectoXMLException($"{documentType.ToString()} not supported"));
//throw new VectoXMLException($"{documentType.ToString()} not supported");
}
return null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment