001package co.codewizards.cloudstore.core.repo.local;
002
003import java.io.File;
004
005/**
006 * Thrown if a {@link LocalRepoManager} could not be created for a given {@link File}, because the file does not exist.
007 * @author Marco หงุ่ยตระกูล-Schulze - marco at codewizards dot co
008 */
009public class FileNotFoundException extends LocalRepoManagerException {
010        private static final long serialVersionUID = 1L;
011
012        private File file;
013
014        public FileNotFoundException(File file) {
015                super(createMessage(file));
016                this.file = file;
017        }
018
019        public FileNotFoundException(File file, Throwable cause) {
020                super(createMessage(file), cause);
021                this.file = file;
022        }
023
024        public File getFile() {
025                return file;
026        }
027
028        protected static String createMessage(File file) {
029                return String.format("File does not exist: %s", file == null ? null : file.getAbsolutePath());
030        }
031}