Skip to content

Commit 5f106c9

Browse files
author
zhangheng09
committed
当page为null时,意味着非正常的响应状态,应该抛出异常,否则SpiderListener的onSuccess方法和onError方法都会执行
1 parent c0b8e8f commit 5f106c9

File tree

1 file changed

+1
-3
lines changed
  • webmagic-core/src/main/java/us/codecraft/webmagic

1 file changed

+1
-3
lines changed

webmagic-core/src/main/java/us/codecraft/webmagic/Spider.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,7 @@ public void test(String... urls) {
408408
protected void processRequest(Request request) {
409409
Page page = downloader.download(request, this);
410410
if (page == null) {
411-
sleep(site.getRetrySleepTime());
412-
onError(request);
413-
return;
411+
throw new RuntimeException("unaccpetable response status");
414412
}
415413
// for cycle retry
416414
if (page.isNeedCycleRetry()) {

0 commit comments

Comments
 (0)