001// License: GPL. For details, see LICENSE file. 002package org.openstreetmap.josm.data.osm.search; 003 004import static org.openstreetmap.josm.tools.I18n.tr; 005 006import org.openstreetmap.josm.data.osm.search.PushbackTokenizer.Token; 007 008/** 009 * Search compiler parsing error. 010 * @since 12656 (extracted from {@link SearchCompiler}). 011 */ 012public class SearchParseError extends Exception { 013 014 /** 015 * Constructs a new generic {@code ParseError}. 016 * @param msg the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. 017 */ 018 public SearchParseError(String msg) { 019 super(msg); 020 } 021 022 /** 023 * Constructs a new generic {@code ParseError}. 024 * @param msg the detail message. The detail message is saved for later retrieval by the {@link #getMessage()} method. 025 * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method). 026 */ 027 public SearchParseError(String msg, Throwable cause) { 028 super(msg, cause); 029 } 030 031 /** 032 * Constructs a new detailed {@code ParseError}. 033 * @param expected expected token 034 * @param found actual token 035 */ 036 public SearchParseError(Token expected, Token found) { 037 this(tr("Unexpected token. Expected {0}, found {1}", expected, found)); 038 } 039}