fix: surface ntfs create result token errors
This commit is contained in:
@@ -591,14 +591,18 @@ namespace LiamWorkflowDiagnostics
|
|||||||
}
|
}
|
||||||
if (string.IsNullOrWhiteSpace(parentPath))
|
if (string.IsNullOrWhiteSpace(parentPath))
|
||||||
throw new InvalidOperationException("Parent Folder Path konnte nicht ermittelt werden.");
|
throw new InvalidOperationException("Parent Folder Path konnte nicht ermittelt werden.");
|
||||||
|
var ownerSids = ParseIdentifierList(NtfsCreateOwnerSidsTextBox.Text, "Owner SIDs");
|
||||||
|
if (ownerSids.Count == 0)
|
||||||
|
throw new InvalidOperationException("Owner SIDs: mindestens ein Eintrag ist fuer die Ordneranlage erforderlich.");
|
||||||
|
|
||||||
var result = await provider.CreateDataAreaAsync(
|
var result = EnsureSuccessfulResultToken(await provider.CreateDataAreaAsync(
|
||||||
folderPath,
|
folderPath,
|
||||||
parentPath,
|
parentPath,
|
||||||
ParseKeyValueLines(CustomTagsTextBox.Text, "Custom Tags"),
|
ParseKeyValueLines(CustomTagsTextBox.Text, "Custom Tags"),
|
||||||
ParseIdentifierList(NtfsCreateOwnerSidsTextBox.Text, "Owner SIDs"),
|
ownerSids,
|
||||||
ParseIdentifierList(NtfsCreateReaderSidsTextBox.Text, "Reader SIDs"),
|
ParseIdentifierList(NtfsCreateReaderSidsTextBox.Text, "Reader SIDs"),
|
||||||
ParseIdentifierList(NtfsCreateWriterSidsTextBox.Text, "Writer SIDs"));
|
ParseIdentifierList(NtfsCreateWriterSidsTextBox.Text, "Writer SIDs")),
|
||||||
|
"NTFS Folder Create");
|
||||||
|
|
||||||
return MapResultToken(result);
|
return MapResultToken(result);
|
||||||
});
|
});
|
||||||
@@ -618,7 +622,7 @@ namespace LiamWorkflowDiagnostics
|
|||||||
ParseIdentifierList(NtfsEnsureWriterSidsTextBox.Text, "Writer SIDs"),
|
ParseIdentifierList(NtfsEnsureWriterSidsTextBox.Text, "Writer SIDs"),
|
||||||
NtfsEnsureTraverseCheckBox.IsChecked ?? false);
|
NtfsEnsureTraverseCheckBox.IsChecked ?? false);
|
||||||
|
|
||||||
return MapResultToken(result);
|
return MapResultToken(EnsureSuccessfulResultToken(result, "NTFS Ensure Groups / ACLs"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -910,6 +914,22 @@ namespace LiamWorkflowDiagnostics
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ResultToken EnsureSuccessfulResultToken(ResultToken token, string actionName)
|
||||||
|
{
|
||||||
|
if (token == null)
|
||||||
|
throw new InvalidOperationException($"{actionName}: kein Ergebnis vom Provider erhalten.");
|
||||||
|
|
||||||
|
if (token.resultErrorId != 0)
|
||||||
|
{
|
||||||
|
var message = string.IsNullOrWhiteSpace(token.resultMessage)
|
||||||
|
? "Unbekannter Fehler im Provider."
|
||||||
|
: token.resultMessage.Trim();
|
||||||
|
throw new InvalidOperationException($"[{token.resultErrorId}] {message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
private List<object> MapSecurityGroupResults(IEnumerable<Tuple<string, string, string, string>> groups)
|
private List<object> MapSecurityGroupResults(IEnumerable<Tuple<string, string, string, string>> groups)
|
||||||
{
|
{
|
||||||
return (groups ?? Enumerable.Empty<Tuple<string, string, string, string>>())
|
return (groups ?? Enumerable.Empty<Tuple<string, string, string, string>>())
|
||||||
|
|||||||
Reference in New Issue
Block a user