Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
MissingParserException | 30 | 3 | 0% | 3 | 6 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.rendering.parser; | |
21 | ||
22 | import org.xwiki.rendering.syntax.Syntax; | |
23 | ||
24 | /** | |
25 | * Specialized parser exception to report missing parser for a given syntax. | |
26 | * | |
27 | * @version $Id: b0db2852b15377fc8cc975c08fe5a3c3e1cfc0c7 $ | |
28 | * @since 6.0M2 | |
29 | */ | |
30 | public class MissingParserException extends Exception | |
31 | { | |
32 | private static final long serialVersionUID = 1L; | |
33 | ||
34 | /** | |
35 | * Construct a new MissingParserException for the specified syntax. | |
36 | * | |
37 | * @param syntax The requested syntax. Used to compose a message for Throwable.getMessage() method. | |
38 | */ | |
39 | 0 | public MissingParserException(Syntax syntax) |
40 | { | |
41 | 0 | super(getMessage(syntax)); |
42 | } | |
43 | ||
44 | /** | |
45 | * Construct a new MissingParserException for the specified syntax and cause. | |
46 | * | |
47 | * @param syntax The requested syntax. Used to compose a message for Throwable.getMessage() method. | |
48 | * @param throwable the cause. This can be retrieved later by the Throwable.getCause() method. (A null value | |
49 | * is permitted, and indicates that the cause is nonexistent or unknown) | |
50 | */ | |
51 | 0 | public MissingParserException(Syntax syntax, Throwable throwable) |
52 | { | |
53 | 0 | super(getMessage(syntax), throwable); |
54 | } | |
55 | ||
56 | 0 | private static String getMessage(Syntax syntax) |
57 | { | |
58 | 0 | return String.format("Failed to find a parser for syntax [%s]", syntax); |
59 | } | |
60 | } |