1
package latexDraw.util;
3
import latexDraw.lang.LaTeXDrawLang;
6
* This class allows the management of exceptions.
7
* This file is part of LaTeXDraw<br>
8
* Copyright (c) 2005-2008 Arnaud BLOUIN<br>
10
* LaTeXDraw is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.<br>
15
* LaTeXDraw is distributed without any warranty; without even the
16
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
17
* PURPOSE. See the GNU General Public License for more details.<br>
20
* @author Arnaud BLOUIN<br>
23
public class LaTeXDrawException extends Exception
25
private static final long serialVersionUID = 1L;
27
/** The code of the exception generated */
28
private int errorCode;
30
public static final short INCORRECT_VALUE = 0;
31
public static final short NOT_TEXDRAW_FILE = 1;
32
public static final short INVALID_TEXDRAW_VERSION = 2;
33
public static final short INVALID_PICTURE = 3;
37
* The constructor using the identifier of the error
38
* @param errorCode The identifier of the error
40
public LaTeXDrawException(int errorCode)
42
this.errorCode = errorCode;
48
* Allows to get the code of the error
49
* @return The code of the error
51
public int getErrorCode()
59
public String toString()
63
case INCORRECT_VALUE : return LaTeXDrawLang.getOthersString("LaTeXDrawException.valueInc"); //$NON-NLS-1$
64
case NOT_TEXDRAW_FILE : return LaTeXDrawLang.getOthersString("LaTeXDrawException.invFile"); //$NON-NLS-1$
65
case INVALID_TEXDRAW_VERSION : return LaTeXDrawLang.getOthersString("LaTeXDrawException.invLaTeXDrawVer"); //$NON-NLS-1$
66
case INVALID_PICTURE : return LaTeXDrawLang.getString1_7("LaTeXDrawException.0"); //$NON-NLS-1$
68
default : return LaTeXDrawLang.getOthersString("LaTeXDrawException.invException"); //$NON-NLS-1$