01 /* This file is part of the project "Hilbert II" - http://www.qedeq.org
02 *
03 * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
04 *
05 * "Hilbert II" is free software; you can redistribute
06 * it and/or modify it under the terms of the GNU General Public
07 * License as published by the Free Software Foundation; either
08 * version 2 of the License, or (at your option) any later version.
09 *
10 * This program 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
13 * GNU General Public License for more details.
14 */
15
16 package org.qedeq.kernel.se.common;
17
18
19 /**
20 * Base class for all exceptions of this application.
21 *
22 * @author Michael Meyling
23 */
24 public abstract class QedeqException extends Exception {
25
26 /** Error code of this Exception. */
27 private final int errorCode;
28
29 /**
30 * Constructor.
31 *
32 * @param errorCode Error code of this message.
33 * @param message Error message.
34 * @param cause Detailed exception information.
35 */
36 public QedeqException(final int errorCode, final String message,
37 final Throwable cause) {
38 super(message, cause);
39 this.errorCode = errorCode;
40 }
41
42 /**
43 * Constructor.
44 *
45 * @param errorCode Error code of this message.
46 * @param message Error message.
47 */
48 public QedeqException(final int errorCode, final String message) {
49 super(message);
50 this.errorCode = errorCode;
51 }
52
53 /**
54 * Get error code.
55 *
56 * @return Error code.
57 */
58 public int getErrorCode() {
59 return errorCode;
60 }
61
62 public String toString() {
63 return getErrorCode() + ": " + getMessage();
64 }
65
66 }
|