5 changed files with 74 additions and 0 deletions
@ -0,0 +1,19 @@ |
|||||
|
package com.crawler.exception; |
||||
|
|
||||
|
public class HtmlParseException extends ParseException { |
||||
|
private String sourceUrl; |
||||
|
|
||||
|
public HtmlParseException(String message, String sourceUrl) { |
||||
|
super(message); |
||||
|
this.sourceUrl = sourceUrl; |
||||
|
} |
||||
|
|
||||
|
public HtmlParseException(String message, String sourceUrl, Throwable cause) { |
||||
|
super(message, cause); |
||||
|
this.sourceUrl = sourceUrl; |
||||
|
} |
||||
|
|
||||
|
public String getSourceUrl() { |
||||
|
return sourceUrl; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
package com.crawler.exception; |
||||
|
|
||||
|
public class HttpRequestException extends NetworkException { |
||||
|
private int statusCode; |
||||
|
|
||||
|
public HttpRequestException(String message, int statusCode) { |
||||
|
super(message); |
||||
|
this.statusCode = statusCode; |
||||
|
} |
||||
|
|
||||
|
public HttpRequestException(String message, int statusCode, Throwable cause) { |
||||
|
super(message, cause); |
||||
|
this.statusCode = statusCode; |
||||
|
} |
||||
|
|
||||
|
public int getStatusCode() { |
||||
|
return statusCode; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
package com.crawler.exception; |
||||
|
|
||||
|
public class InvalidUrlException extends ConfigurationException { |
||||
|
private String invalidUrl; |
||||
|
|
||||
|
public InvalidUrlException(String message, String invalidUrl) { |
||||
|
super(message); |
||||
|
this.invalidUrl = invalidUrl; |
||||
|
} |
||||
|
|
||||
|
public String getInvalidUrl() { |
||||
|
return invalidUrl; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
package com.crawler.exception; |
||||
|
|
||||
|
public class NetworkException extends CrawlerException { |
||||
|
public NetworkException(String message) { |
||||
|
super(message); |
||||
|
} |
||||
|
|
||||
|
public NetworkException(String message, Throwable cause) { |
||||
|
super(message, cause); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
package com.crawler.exception; |
||||
|
|
||||
|
public class ParseException extends CrawlerException { |
||||
|
public ParseException(String message) { |
||||
|
super(message); |
||||
|
} |
||||
|
|
||||
|
public ParseException(String message, Throwable cause) { |
||||
|
super(message, cause); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue