forked from JohnnyCrazy/SpotifyAPI-NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAPIPagingException.cs
More file actions
31 lines (24 loc) · 902 Bytes
/
APIPagingException.cs
File metadata and controls
31 lines (24 loc) · 902 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System.Globalization;
using System.Runtime.Serialization;
using System;
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) { }
protected APIPagingException(SerializationInfo info, StreamingContext context) : base(info, context) { }
}
}