interruptprocessingrobotexceptionhandler.java

来自「一个Java的网络爬虫」· Java 代码 · 共 29 行

JAVA
29
字号
package net.matuschek.spider;

import java.net.URL;


/**
 * InterruptProcessingRobotExceptionHandler
 * This is a concrete ExceptionHandler, which interupts the processing robot
 * by throwing a runtime exception.
 * <p>
 * @author cn
 * @version 0.1
 */
public class InterruptProcessingRobotExceptionHandler implements RobotExceptionHandler {

	/**
	 * This exception handler throws a runtime exception with the message of the
	 * incoming exception.
	 * @see RobotExceptionHandler#handleException(WebRobot, URL, Exception)
	 */
	public void handleException(WebRobot robot, URL url, Exception e) {
		String errorMessage = e.getMessage();
		//System.out.println("ERROR: " + errorMessage);
		//robot.stopRobot();
		throw new RuntimeException(errorMessage);
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?