Skip to content

Commit a0496ef

Browse files
author
邹嵩
committed
异常信息不应该用.结尾
1 parent d4ccb7c commit a0496ef

35 files changed

+75
-75
lines changed

nuget/DotnetSpider.Core.nuspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
33
<metadata>
44
<id>DotnetSpider2.Core</id>
5-
<version>2.4.2-beta7</version>
5+
<version>2.4.3</version>
66
<authors>[email protected];Walterwhatwater;xiaohuan0204</authors>
77
<owners>[email protected]</owners>
88
<iconUrl>https://github.com/zlzforever/DotnetSpider/blob/master/images/icon.png?raw=true</iconUrl>

nuget/DotnetSpider.Extension.nuspec

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
33
<metadata>
44
<id>DotnetSpider2.Extension</id>
5-
<version>2.4.2-beta7</version>
5+
<version>2.4.3</version>
66
<authors>[email protected];Walterwhatwater;xiaohuan0204</authors>
77
<owners>[email protected]</owners>
88
<iconUrl>https://github.com/zlzforever/DotnetSpider/blob/master/images/icon.png?raw=true</iconUrl>
@@ -13,7 +13,7 @@
1313
<description>A .NET Standard web crawling library similar to WebMagic and Scrapy. It is a lightweight ,efficient and fast high-level web crawling &amp; scraping framework for .NET</description>
1414
<dependencies>
1515
<group targetFramework=".NETStandard2.0">
16-
<dependency id="DotnetSpider2.Core" version="2.4.2-beta7" />
16+
<dependency id="DotnetSpider2.Core" version="2.4.3" />
1717
<dependency id="Dapper" version="1.50.2"/>
1818
<dependency id="MailKit" version="2.0.1"/>
1919
<dependency id="MongoDB.Driver" version="2.5.0"/>
@@ -28,7 +28,7 @@
2828
<dependency id="MessagePack" version="1.7.3.4"/>
2929
</group>
3030
<group targetFramework=".NETFramework4.5" >
31-
<dependency id="DotnetSpider2.Core" version="2.4.2-beta7" />
31+
<dependency id="DotnetSpider2.Core" version="2.4.3" />
3232
<dependency id="Dapper" version="1.50.2"/>
3333
<dependency id="MailKit" version="2.0.1"/>
3434
<dependency id="MongoDB.Driver" version="2.5.0"/>

src/DotnetSpider.Core/Downloader/AfterDownloadCompleteHandler.Extensions.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ public RetryWhenContainsHandler(params string[] contents)
370370
{
371371
if (contents == null || contents.Length == 0)
372372
{
373-
throw new SpiderException("contents should not be empty/null.");
373+
throw new SpiderException("contents should not be empty/null");
374374
}
375375

376376
_contents = contents;
@@ -468,7 +468,7 @@ public RedialWhenExceptionThrowHandler(string exceptionMessage)
468468
{
469469
if (string.IsNullOrWhiteSpace(exceptionMessage))
470470
{
471-
throw new SpiderException("exceptionMessage should not be null or empty.");
471+
throw new SpiderException("exceptionMessage should not be null or empty");
472472
}
473473

474474
_exceptionMessage = exceptionMessage;
@@ -521,10 +521,10 @@ public class RedialAndUpdateCookiesWhenContainsHandler : AfterDownloadCompleteHa
521521
/// <param name="contents">包含的内容(specified contents)</param>
522522
public RedialAndUpdateCookiesWhenContainsHandler(ICookieInjector cookieInjector, params string[] contents)
523523
{
524-
_cookieInjector = cookieInjector ?? throw new SpiderException("cookieInjector should not be null.");
524+
_cookieInjector = cookieInjector ?? throw new SpiderException("cookieInjector should not be null");
525525
if (contents == null || contents.Length == 0)
526526
{
527-
throw new SpiderException("contents should not be null or empty.");
527+
throw new SpiderException("contents should not be null or empty");
528528
}
529529

530530
_contents = contents;
@@ -616,7 +616,7 @@ public override void Handle(ref Page page, IDownloader downloader, ISpider spide
616616

617617
if (begin < 0)
618618
{
619-
throw new SpiderException($"Cutout failed, can not find begin string: {_startPart}.");
619+
throw new SpiderException($"Cutout failed, can not find begin string: {_startPart}");
620620
}
621621

622622
int end = rawText.IndexOf(_endPart, begin, StringComparison.Ordinal);
@@ -629,7 +629,7 @@ public override void Handle(ref Page page, IDownloader downloader, ISpider spide
629629

630630
if (begin < 0 || length < 0)
631631
{
632-
throw new SpiderException("Cutout failed. Please check your settings.");
632+
throw new SpiderException("Cutout failed. Please check your settings");
633633
}
634634

635635
string newRawText = rawText.Substring(begin, length).Trim();

src/DotnetSpider.Core/Downloader/HttpClientPool.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ public HttpClientElement GetHttpClient(ISpider spider, IDownloader downloader, C
4343
{
4444
if (cookieContainer == null)
4545
{
46-
throw new SpiderException($"{nameof(cookieContainer)} should not be null.");
46+
throw new SpiderException($"{nameof(cookieContainer)} should not be null");
4747
}
4848
if (downloader == null)
4949
{
50-
throw new SpiderException($"{nameof(downloader)} should not be null.");
50+
throw new SpiderException($"{nameof(downloader)} should not be null");
5151
}
5252
var newCookieContainer = GenerateNewCookieContainer(spider, downloader, cookieContainer, cookieInjector);
5353

src/DotnetSpider.Core/Infrastructure/BlockingQueue.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ public class QueueTimeoutException : SpiderException
402402
/// <summary>
403403
/// 构造方法
404404
/// </summary>
405-
public QueueTimeoutException() : base("Queue method timed out on wait.")
405+
public QueueTimeoutException() : base("Queue method timed out on wait")
406406
{
407407
}
408408
}

src/DotnetSpider.Core/Infrastructure/Database/DatabaseExtensions.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ public static DbConnection CreateDbConnection(this ConnectionStringSettings conn
2929
{
3030
if (connectionStringSettings == null)
3131
{
32-
throw new SpiderException("ConnectionStringSetting is null.");
32+
throw new SpiderException("ConnectionStringSetting is null");
3333
}
3434
if (string.IsNullOrWhiteSpace(connectionStringSettings.ConnectionString) || string.IsNullOrWhiteSpace(connectionStringSettings.ProviderName))
3535
{
36-
throw new SpiderException("ConnectionStringSetting is incorrect.");
36+
throw new SpiderException("ConnectionStringSetting is incorrect");
3737
}
3838

3939
var factory = DbProviderFactories.GetFactory(connectionStringSettings.ProviderName);
@@ -64,7 +64,7 @@ public static DbConnection CreateDbConnection(this ConnectionStringSettings conn
6464
}
6565
}
6666

67-
throw new SpiderException($"Create or open DbConnection failed: {connectionStringSettings.ConnectionString}.");
67+
throw new SpiderException($"Create or open DbConnection failed: {connectionStringSettings.ConnectionString}");
6868
}
6969

7070
/// <summary>
@@ -128,7 +128,7 @@ public static DbConnection CreateDbConnection(Database source, string connectStr
128128
}
129129
}
130130

131-
throw new SpiderException("Create connection failed.");
131+
throw new SpiderException("Create connection failed");
132132
}
133133

134134
/// <summary>

src/DotnetSpider.Core/Infrastructure/Database/DbProviderFactories.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ public static DbProviderFactory GetFactory(string providerInvariantName)
114114
Configs.TryGetValue(providerInvariantName, out var factory);
115115
if (factory == null)
116116
{
117-
throw new SpiderException("Provider not found.");
117+
throw new SpiderException("Provider not found");
118118
}
119119
return factory;
120120
}
121-
throw new SpiderException("Provider not found.");
121+
throw new SpiderException("Provider not found");
122122
}
123123

124124
/// <summary>

src/DotnetSpider.Core/Pipeline/BaseFilePipeline.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected void InitFolder(string interval)
3737
{
3838
if (string.IsNullOrWhiteSpace(interval))
3939
{
40-
throw new SpiderException("Interval path should not be null.");
40+
throw new SpiderException("Interval path should not be null");
4141
}
4242
if (!interval.EndsWith(Env.PathSeperator))
4343
{

src/DotnetSpider.Core/Processor/TargetUrlsExtractor.Extensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ protected PaginationTargetUrlsExtractor(string paginationStr, ITargetUrlsExtract
267267
{
268268
if (string.IsNullOrWhiteSpace(paginationStr))
269269
{
270-
throw new SpiderException("paginationStr should not be null or empty.");
270+
throw new SpiderException("paginationStr should not be null or empty");
271271
}
272272

273273
PaginationStr = paginationStr;

src/DotnetSpider.Core/Proxy/HttpProxyPool.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class HttpProxyPool : IHttpProxyPool
3131
/// <param name="reuseInterval">代理不被再次使用的间隔</param>
3232
public HttpProxyPool(IProxySupplier supplier, int reuseInterval = 500)
3333
{
34-
_supplier = supplier ?? throw new SpiderException("IProxySupplier should not be null.");
34+
_supplier = supplier ?? throw new SpiderException("IProxySupplier should not be null");
3535

3636
_reuseInterval = reuseInterval;
3737

@@ -69,7 +69,7 @@ public UseSpecifiedUriWebProxy GetProxy()
6969
Thread.Sleep(1000);
7070
}
7171

72-
throw new SpiderException("Get proxy timeout.");
72+
throw new SpiderException("Get proxy timeout");
7373
}
7474

7575
/// <summary>

src/DotnetSpider.Core/Redial/InternetDetector/DefaultInternetDetector.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public DefaultInternetDetector(string url = "www.baidu.com", int timeout = 10)
3030
Timeout = timeout;
3131
if (!Uri.TryCreate(_url, UriKind.RelativeOrAbsolute, out var _))
3232
{
33-
throw new SpiderException($"{url} is not a correct uri.");
33+
throw new SpiderException($"{url} is not a correct uri");
3434
}
3535
_url = url;
3636
}

src/DotnetSpider.Core/Redial/Redialer/AdslRedialer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public AdslRedialer(string configPath)
3737
}
3838
else
3939
{
40-
throw new SpiderException($"Unfound adsl config: {path}.");
40+
throw new SpiderException($"Unfound adsl config: {path}");
4141
}
4242
}
4343

src/DotnetSpider.Core/Scheduler/DuplicateRemovedScheduler.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public virtual void Init(ISpider spider)
9696
}
9797
else
9898
{
99-
throw new SpiderException("Scheduler already init.");
99+
throw new SpiderException("Scheduler already init");
100100
}
101101
}
102102

src/DotnetSpider.Core/Selector/Selectable.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public override ISelectable Select(ISelector selector)
127127
}
128128
return new Selectable(resluts);
129129
}
130-
throw new SpiderException("Selector is null.");
130+
throw new SpiderException("Selector is null");
131131
}
132132

133133
/// <summary>
@@ -151,7 +151,7 @@ public override ISelectable SelectList(ISelector selector)
151151
return new Selectable(resluts);
152152
}
153153

154-
throw new SpiderException("Selector is null.");
154+
throw new SpiderException("Selector is null");
155155
}
156156

157157
/// <summary>

src/DotnetSpider.Core/Spider.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ public int EmptySleepTime
274274
}
275275
else
276276
{
277-
throw new SpiderException("Sleep time should be large than 0.");
277+
throw new SpiderException("Sleep time should be large than 0");
278278
}
279279
}
280280
}
@@ -938,7 +938,7 @@ protected virtual void InitComponent(params string[] arguments)
938938

939939
if (PageProcessors == null || PageProcessors.Count == 0)
940940
{
941-
throw new SpiderException("Count of PageProcessor is zero.");
941+
throw new SpiderException("Count of PageProcessor is zero");
942942
}
943943

944944
InitPipelines(arguments);
@@ -1260,7 +1260,7 @@ protected void CheckIfRunning()
12601260
{
12611261
if (Stat == Status.Running)
12621262
{
1263-
throw new SpiderException("Spider is running.");
1263+
throw new SpiderException("Spider is running");
12641264
}
12651265
}
12661266

src/DotnetSpider.Extension/CommonSpider.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ protected override void BuildStartRequestsFinished()
192192
}
193193
if (!ifBuildFinished)
194194
{
195-
var msg = "Init status set failed.";
195+
var msg = "Init status set failed";
196196
Logger.Log(Identity, msg, Level.Error);
197197
throw new SpiderException(msg);
198198
}
@@ -212,7 +212,7 @@ protected override void BuildStartRequestsFinished()
212212
}
213213
if (!ifRemoveInitLocker)
214214
{
215-
var msg = "Remove init locker failed.";
215+
var msg = "Remove init locker failed";
216216
Logger.Log(Identity, msg, Level.Error);
217217
throw new SpiderException(msg);
218218
}

src/DotnetSpider.Extension/Downloader/AfterDownloadCompleteHandler.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public DownloadCache(BaseEntityPipeline pipeline)
3030

3131
if (_pipeline == null)
3232
{
33-
throw new SpiderException("StorageCache's pipeline unfound.");
33+
throw new SpiderException("StorageCache's pipeline unfound");
3434
}
3535
_pipeline.AddEntity(new EntityDefine<DownloadCacheData>());
3636
_pipeline.Init();

src/DotnetSpider.Extension/Downloader/WebDriverCookieInjector.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected override CookieCollection GetCookies(ISpider spider)
105105
{
106106
if (string.IsNullOrEmpty(User) || string.IsNullOrEmpty(Password) || UserSelector == null || PasswordSelector == null)
107107
{
108-
throw new SpiderException("Arguments of WebDriverCookieInjector are incorrect.");
108+
throw new SpiderException("Arguments of WebDriverCookieInjector are incorrect");
109109
}
110110
var cookies = new Dictionary<string, string>();
111111

src/DotnetSpider.Extension/EntitySpider.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ protected override void InitPipelines(params string[] arguments)
145145

146146
if (entityProcessors.Count != 0 && entityPipelines.Count == 0)
147147
{
148-
throw new SpiderException("You may miss a entity pipeline.");
148+
throw new SpiderException("You may miss a entity pipeline");
149149
}
150150
foreach (var processor in entityProcessors)
151151
{

src/DotnetSpider.Extension/Infrastructure/SelectorUtil.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public static ISelector ToSelector(this ISelectorAttribute selector)
120120
}
121121
default:
122122
{
123-
throw new SpiderException($"Selector {selector} unsupoort.");
123+
throw new SpiderException($"Selector {selector} unsupoort");
124124
}
125125
}
126126
}

src/DotnetSpider.Extension/Infrastructure/WebDriverUtil.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public string Proxy
7171
}
7272
}
7373

74-
throw new SpiderException("Proxy string should be like 192.168.1.100:8080.");
74+
throw new SpiderException("Proxy string should be like 192.168.1.100:8080");
7575
}
7676
}
7777
}

0 commit comments

Comments
 (0)