relativitydev / Gravity

ORM Framework for Relativity Custom Development
Other
16 stars 10 forks source link

Improve RsapiDao GetResultData method #150

Open Arithmomaniac opened 6 years ago

Arithmomaniac commented 6 years ago

Currently, method give little detail on error.

A more robust solution would do something like this:

private static string GenerateMessage(string globalErrorMessage, List<Result<T>> failureItems)
{
    var sb = new StringBuilder(globalErrorMessage ?? "One or more results failed.");
    foreach (var message in failureItems.Select(x => $"- {x.Message}"))
        sb.AppendLine().Append(message);
    return sb.ToString();
}
KalinaTSD commented 5 years ago

Sounds valuable for the whole ORM error handling, It will be applied by me. Thanks!