All Downloads are FREE. Search and download functionalities are using the official Maven repository.

play.exceptions.CacheException Maven / Gradle / Ivy

There is a newer version: 1.5.0
Show newest version
package play.exceptions;

import java.util.Arrays;
import java.util.List;
import play.classloading.ApplicationClasses.ApplicationClass;
import play.Play;

/**
 * Cache related exception
 */
public class CacheException extends PlayException {
    
    String sourceFile;
    List source;
    Integer line;    

    public CacheException(String message, Throwable cause) {
        super(message, cause);
        StackTraceElement element = getInterestingStrackTraceElement(cause);
        if(element != null) {
            ApplicationClass applicationClass = Play.classes.getApplicationClass(element.getClassName());
            sourceFile = applicationClass.javaFile.relativePath();
            source = Arrays.asList(applicationClass.javaSource.split("\n"));
            line = element.getLineNumber();
        }
    }

    @Override
    public String getErrorTitle() {
        return "Cache error";
    } 

    @Override
    public String getErrorDescription() {
        return getMessage();
    }
    
    public String getSourceFile() {
        return sourceFile;
    }

    public List getSource() {
        return source;
    }

    public Integer getLineNumber() {
        return line;
    }

    @Override
    public boolean isSourceAvailable() {
        return sourceFile != null;
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy