tikhomirov@498: /*
tikhomirov@618: * Copyright (c) 2012-2013 TMate Software Ltd
tikhomirov@498: *
tikhomirov@498: * This program is free software; you can redistribute it and/or modify
tikhomirov@498: * it under the terms of the GNU General Public License as published by
tikhomirov@498: * the Free Software Foundation; version 2 of the License.
tikhomirov@498: *
tikhomirov@498: * This program is distributed in the hope that it will be useful,
tikhomirov@498: * but WITHOUT ANY WARRANTY; without even the implied warranty of
tikhomirov@498: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
tikhomirov@498: * GNU General Public License for more details.
tikhomirov@498: *
tikhomirov@498: * For information on how to redistribute this software under
tikhomirov@498: * the terms of a license other than GNU General Public License
tikhomirov@498: * contact TMate Software at support@hg4j.com
tikhomirov@498: */
tikhomirov@498: package org.tmatesoft.hg.core;
tikhomirov@498:
tikhomirov@498: import java.io.File;
tikhomirov@498: import java.io.IOException;
tikhomirov@498:
tikhomirov@498: /**
tikhomirov@498: * Tailored wrap for {@link IOException} and similar I/O-related issues. Unlike {@link IOException},
tikhomirov@498: * keeps track of {@link File} that caused the problem. Besides, additional information (like revision,
tikhomirov@498: * see {@link HgException}) may be attached.
tikhomirov@498: *
tikhomirov@498: * @author Artem Tikhomirov
tikhomirov@498: * @author TMate Software Ltd.
tikhomirov@498: */
tikhomirov@498: @SuppressWarnings("serial")
tikhomirov@498: public class HgIOException extends HgException {
tikhomirov@498: private final File file;
tikhomirov@498:
tikhomirov@498: public HgIOException(String message, File troubleFile) {
tikhomirov@498: this(message, null, troubleFile);
tikhomirov@498: }
tikhomirov@498:
tikhomirov@498: /**
tikhomirov@498: * @param message describes the issue, never null
tikhomirov@498: * @param cause root cause for the error, likely {@link IOException} or its subclass, but not necessarily, and may be omitted.
tikhomirov@498: * @param troubleFile file we tried to deal with, never null
tikhomirov@498: */
tikhomirov@498: public HgIOException(String message, Exception cause, File troubleFile) {
tikhomirov@498: super(message, cause);
tikhomirov@498: file = troubleFile;
tikhomirov@498: }
tikhomirov@498:
tikhomirov@618: /**
tikhomirov@618: * @return file that causes trouble, may be null
tikhomirov@618: */
tikhomirov@498: public File getFile() {
tikhomirov@498: return file;
tikhomirov@498: }
tikhomirov@498: }