mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
29 lines
859 B
C#
29 lines
859 B
C#
using System;
|
|
using System.Text;
|
|
using BTCPayServer.Client.Models;
|
|
|
|
namespace BTCPayServer.Client
|
|
{
|
|
public class GreenfieldValidationException : Exception
|
|
{
|
|
public GreenfieldValidationException(Models.GreenfieldValidationError[] errors) : base(BuildMessage(errors))
|
|
{
|
|
ValidationErrors = errors;
|
|
}
|
|
|
|
private static string BuildMessage(GreenfieldValidationError[] errors)
|
|
{
|
|
if (errors == null)
|
|
throw new ArgumentNullException(nameof(errors));
|
|
StringBuilder builder = new StringBuilder();
|
|
foreach (var error in errors)
|
|
{
|
|
builder.AppendLine($"{error.Path}: {error.Message}");
|
|
}
|
|
return builder.ToString();
|
|
}
|
|
|
|
public Models.GreenfieldValidationError[] ValidationErrors { get; }
|
|
}
|
|
}
|