001package jmri.util.prefs;
002
003/**
004 * This exception represents an exception thrown while attempting to initialize
005 * a PreferencesProvider.
006 *
007 * @author Randall Wood (C) 2015
008 */
009public class InitializationException extends Exception {
010
011    private String localizedMessage = null;
012
013    public InitializationException(String message, String localized) {
014        this(message, localized, null);
015    }
016
017    public InitializationException(String message, String localized, Throwable cause) {
018        super(message, cause);
019        this.localizedMessage = localized;
020    }
021
022    public InitializationException(Throwable cause) {
023        super(cause);
024        this.localizedMessage = cause.getLocalizedMessage();
025    }
026
027    @Override
028    public String getLocalizedMessage() {
029        return (this.localizedMessage == null) ? this.getMessage() : this.localizedMessage;
030    }
031}