1*650b9f74SAndroid Build Coastguard Worker /* 2*650b9f74SAndroid Build Coastguard Worker * Copyright (C) 2010 Google Inc. 3*650b9f74SAndroid Build Coastguard Worker * 4*650b9f74SAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*650b9f74SAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*650b9f74SAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*650b9f74SAndroid Build Coastguard Worker * 8*650b9f74SAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*650b9f74SAndroid Build Coastguard Worker * 10*650b9f74SAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*650b9f74SAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*650b9f74SAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*650b9f74SAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*650b9f74SAndroid Build Coastguard Worker * limitations under the License. 15*650b9f74SAndroid Build Coastguard Worker */ 16*650b9f74SAndroid Build Coastguard Worker 17*650b9f74SAndroid Build Coastguard Worker package com.google.streamhtmlparser; 18*650b9f74SAndroid Build Coastguard Worker 19*650b9f74SAndroid Build Coastguard Worker /** 20*650b9f74SAndroid Build Coastguard Worker * Checked exception thrown on an unrecoverable error during parsing. 21*650b9f74SAndroid Build Coastguard Worker * 22*650b9f74SAndroid Build Coastguard Worker * @see Parser#parse(String) 23*650b9f74SAndroid Build Coastguard Worker */ 24*650b9f74SAndroid Build Coastguard Worker public class ParseException extends Exception { 25*650b9f74SAndroid Build Coastguard Worker 26*650b9f74SAndroid Build Coastguard Worker /** 27*650b9f74SAndroid Build Coastguard Worker * Constructs an {@code ParseException} with no detail message. 28*650b9f74SAndroid Build Coastguard Worker */ ParseException()29*650b9f74SAndroid Build Coastguard Worker public ParseException() {} 30*650b9f74SAndroid Build Coastguard Worker 31*650b9f74SAndroid Build Coastguard Worker /** 32*650b9f74SAndroid Build Coastguard Worker * Constructs an {@code ParseException} with a detail message obtained 33*650b9f74SAndroid Build Coastguard Worker * from the supplied message and the parser's line and column numbers. 34*650b9f74SAndroid Build Coastguard Worker * @param parser the {@code Parser} that triggered the exception 35*650b9f74SAndroid Build Coastguard Worker * @param msg the error message 36*650b9f74SAndroid Build Coastguard Worker */ ParseException(Parser parser, String msg)37*650b9f74SAndroid Build Coastguard Worker public ParseException(Parser parser, String msg) { 38*650b9f74SAndroid Build Coastguard Worker super(String.format("At line: %d (col: %d); %s", 39*650b9f74SAndroid Build Coastguard Worker parser.getLineNumber(), 40*650b9f74SAndroid Build Coastguard Worker parser.getColumnNumber(), 41*650b9f74SAndroid Build Coastguard Worker msg)); 42*650b9f74SAndroid Build Coastguard Worker } 43*650b9f74SAndroid Build Coastguard Worker } 44