using System;
using System.Collections.Generic;
namespace Vanguard.Api
{
/// Ошибка HTTP-API с сохранением кода и сообщения сервера.
public sealed class ApiException : Exception
{
public long StatusCode { get; }
public string Code { get; }
public IReadOnlyList Violations { get; }
public ApiException(
long statusCode,
string code,
string message,
IReadOnlyList violations = null)
: base(message)
{
StatusCode = statusCode;
Code = code ?? string.Empty;
Violations = violations ?? Array.Empty();
}
}
public sealed class ApiViolation
{
public string Code { get; }
public string Message { get; }
public ApiViolation(string code, string message)
{
Code = code ?? string.Empty;
Message = message ?? string.Empty;
}
}
}