source: josm/trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSException.java@ 17333

Last change on this file since 17333 was 17333, checked in by Don-vip, 3 years ago

see #20129 - Fix typos and misspellings in the code (patch by gaben)

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.mappaint.mapcss;
3
4/**
5 * MapCSS parsing error, with line/column information in error message.
6 */
7public class MapCSSException extends RuntimeException {
8
9 /** line number at which the parse error occurred */
10 protected Integer line;
11 /** column number at which the parse error occurred */
12 protected Integer column;
13
14 /**
15 * Constructs a new {@code MapCSSException} with an explicit error message.
16 * @param specialMessage error message
17 */
18 public MapCSSException(String specialMessage) {
19 super(specialMessage);
20 }
21
22 /**
23 * Constructs a new {@code MapCSSException} with a cause.
24 * @param cause the root cause
25 * @since 11562
26 */
27 public MapCSSException(Throwable cause) {
28 super(cause);
29 }
30
31 /**
32 * Sets the column number at which the parse error occurred.
33 * @param column the column number at which the parse error occurred
34 */
35 public void setColumn(int column) {
36 this.column = column;
37 }
38
39 /**
40 * Sets the line number at which the parse error occurred.
41 * @param line the line number at which the parse error occurred
42 */
43 public void setLine(int line) {
44 this.line = line;
45 }
46
47 @Override
48 public String getMessage() {
49 if (line == null || column == null)
50 return super.getMessage();
51 return String.format("Error at line %s, column %s: %s", line, column, super.getMessage());
52 }
53}
Note: See TracBrowser for help on using the repository browser.