You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

23 lines
846 B

package com.crawler.exception.handler;
import com.crawler.exception.CacheException;
import com.crawler.exception.ExceptionHandler;
import com.crawler.view.CrawlerView;
public class CacheExceptionHandler implements ExceptionHandler {
@Override
public void handle(Exception e, CrawlerView view) {
CacheException cacheException = (CacheException) e;
StringBuilder message = new StringBuilder("缓存异常: ");
message.append(cacheException.getMessage());
if (cacheException.getFilePath() != null) {
message.append(" (路径: ").append(cacheException.getFilePath()).append(")");
}
view.showErrorMessage(message.toString());
}
@Override
public Class<? extends Exception> getSupportedExceptionType() {
return CacheException.class;
}
}