public async Task <FileResult> GetFileContentsFromPath(string path) { var result = new FileResult(); string content; try { content = await GetFileFromPath(path); result.SetContent(content); } catch (Exception ex) { result.SetError(ex); _logger.LogError(result.Exception !, "Could not import file from path {path}", path); } if (result.IsSuccess) { if (string.IsNullOrWhiteSpace(result.ContentString)) { result.SetError(new Exception("The supplied file was empty")); } } return(result); }