Skip to content

Commit 5188eb4

Browse files
Resolve Code Factor warning
1 parent 0882a76 commit 5188eb4

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

Src/Notion.Client/NotionApiException.cs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ private NotionApiException(
2121
NotionAPIErrorCode = notionAPIErrorCode;
2222
StatusCode = statusCode;
2323

24+
InitializeData();
25+
}
26+
27+
private void InitializeData()
28+
{
2429
Data.Add("StatusCode", StatusCode);
2530
Data.Add("NotionApiErrorCode", NotionAPIErrorCode);
2631
}
@@ -29,19 +34,4 @@ private NotionApiException(
2934

3035
public HttpStatusCode StatusCode { get; }
3136
}
32-
33-
public sealed class NotionApiRateLimitException : NotionApiException
34-
{
35-
public TimeSpan? RetryAfter { get; }
36-
37-
public NotionApiRateLimitException(
38-
HttpStatusCode statusCode,
39-
NotionAPIErrorCode? notionAPIErrorCode,
40-
string message,
41-
TimeSpan? retryAfter)
42-
: base(statusCode, notionAPIErrorCode, message)
43-
{
44-
RetryAfter = retryAfter;
45-
}
46-
}
4737
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Net;
3+
4+
namespace Notion.Client
5+
{
6+
public sealed class NotionApiRateLimitException : NotionApiException
7+
{
8+
public TimeSpan? RetryAfter { get; }
9+
10+
public NotionApiRateLimitException(
11+
HttpStatusCode statusCode,
12+
NotionAPIErrorCode? notionAPIErrorCode,
13+
string message,
14+
TimeSpan? retryAfter)
15+
: base(statusCode, notionAPIErrorCode, message)
16+
{
17+
RetryAfter = retryAfter;
18+
19+
Data.Add("RetryAfter", retryAfter);
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)