![JAR search and dependency download from the Maven repository](/logo.png)
fr.whimtrip.ext.jwhtscrapper.exception.LinkException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of whimtrip-ext-scrapper Show documentation
Show all versions of whimtrip-ext-scrapper Show documentation
Fully featured highly pluggable and customizable Java scrapping framework
The newest version!
/*
* This code is licensed to WhimTrip©. For any question, please contact the author of the file.
*/
/*
* This code is licensed to WhimTrip©. For any question, please contact the author of the file.
*/
package fr.whimtrip.ext.jwhtscrapper.exception;
import fr.whimtrip.ext.jwhtscrapper.annotation.Link;
import fr.whimtrip.ext.jwhtscrapper.annotation.LinkObject;
import fr.whimtrip.ext.jwhtscrapper.annotation.LinkObjects;
import fr.whimtrip.ext.jwhtscrapper.intfr.HtmlAutoScrapper;
import org.asynchttpclient.BoundRequestBuilder;
import java.lang.reflect.Field;
/**
* Part of project jwht-scrapper
* Created on 29/07/18
*
*
* Thrown when following links results into an exception.
* Link scoped exceptions are usually catched and
* thrown within the scope of the parent object
* {@link HtmlAutoScrapper#scrap(BoundRequestBuilder, Object)}
* as this current exception class whose cause is the original
* exception.
*
*
* This exception can also be thrown if fields are not
* correctly annotated. see {@link Link} for more informations.
*
*
* @author Louis-wht
* @since 1.0.0
*/
public class LinkException extends ScrapperException {
public LinkException(String errorMessage) {
super(errorMessage);
}
public LinkException(Throwable e)
{
this(e.getMessage());
setStackTrace(e.getStackTrace());
}
public LinkException(Field field) {
super(
String.format(
"Field %s has a @%s annotation but isn't mapped to any object through @%s " +
"or @%s annotations",
field, Link.class, LinkObject.class.getName(), LinkObjects.class.getName()
)
);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy