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