mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 22:56:25 +00:00
35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
using System;
|
|
using System.Globalization;
|
|
using System.Runtime.Serialization;
|
|
using SpotifyAPI.Web.Http;
|
|
|
|
namespace SpotifyAPI.Web
|
|
{
|
|
[Serializable]
|
|
public class APIPagingException : APIException
|
|
{
|
|
public TimeSpan RetryAfter { get; }
|
|
|
|
public APIPagingException(IResponse response) : base(response)
|
|
{
|
|
Ensure.ArgumentNotNull(response, nameof(response));
|
|
|
|
if (response.Headers.TryGetValue("Retry-After", out string? retryAfter))
|
|
{
|
|
RetryAfter = TimeSpan.FromSeconds(int.Parse(retryAfter, CultureInfo.InvariantCulture));
|
|
}
|
|
}
|
|
|
|
public APIPagingException() { }
|
|
|
|
public APIPagingException(string message) : base(message) { }
|
|
|
|
public APIPagingException(string message, Exception innerException) : base(message, innerException) { }
|
|
|
|
#if NET8_0_OR_GREATER
|
|
[Obsolete("This API supports obsolete formatter-based serialization. It should not be called or extended by application code.")]
|
|
#endif
|
|
protected APIPagingException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
|
}
|
|
}
|