001// License: GPL. For details, see LICENSE file.
002package org.openstreetmap.josm.gui.help;
003
004/**
005 * Exception thrown when a problem occurs during help contents fetching.
006 * @since 2308
007 */
008public class HelpContentReaderException extends Exception {
009
010    private final int responseCode;
011
012    /**
013     * Constructs a new {@code HelpContentReaderException}.
014     * @param message the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method.
015     * @param responseCode HTTP response code related to the wiki access exception (0 if not applicable)
016     */
017    public HelpContentReaderException(String message, int responseCode) {
018        super(message);
019        this.responseCode = responseCode;
020    }
021
022    /**
023     * Constructs a new {@code HelpContentReaderException}.
024     * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method).
025     *        (A <code>null</code> value is permitted, and indicates that the cause is nonexistent or unknown.)
026     * @param responseCode HTTP response code related to the wiki access exception (0 if not applicable)
027     */
028    public HelpContentReaderException(Throwable cause, int responseCode) {
029        super(cause);
030        this.responseCode = responseCode;
031    }
032
033    /**
034     * Replies the HTTP response code related to the wiki access exception.
035     * If no HTTP response code is available, 0 is replied.
036     *
037     * @return the http response code
038     */
039    public final int getResponseCode() {
040        return responseCode;
041    }
042}