blob: 963094ee702cdbbea32fb9b0846eaf4b638bdae0 [file] [log] [blame]
Nils Diewald5c375702015-02-09 20:58:24 +00001package de.ids_mannheim.korap.util;
2
3/**
4 * Exception class for corpus data processing problems.
Nils Diewaldbb33da22015-03-04 16:24:25 +00005 *
Nils Diewald5c375702015-02-09 20:58:24 +00006 * @author diewald
7 */
8public class CorpusDataException extends Exception {
Nils Diewaldbb33da22015-03-04 16:24:25 +00009
Nils Diewald5c375702015-02-09 20:58:24 +000010 private int errorCode = 0;
Nils Diewaldbb33da22015-03-04 16:24:25 +000011
12
Nils Diewald5c375702015-02-09 20:58:24 +000013 /**
14 * Construct a new CorpusDataException.
15 */
Nils Diewaldbb33da22015-03-04 16:24:25 +000016 public CorpusDataException () {
Nils Diewald5c375702015-02-09 20:58:24 +000017 super();
18 };
19
20
21 /**
22 * Construct a new CorpusDataException.
Nils Diewaldbb33da22015-03-04 16:24:25 +000023 *
24 * @param message
25 * Exception message.
Nils Diewald5c375702015-02-09 20:58:24 +000026 */
27 public CorpusDataException (String message) {
28 super(message);
29 };
30
31
32 /**
33 * Construct a new CorpusDataException.
Nils Diewaldbb33da22015-03-04 16:24:25 +000034 *
35 * @param code
36 * An integer value as an error code.
37 * @param message
38 * Exception message.
Nils Diewald5c375702015-02-09 20:58:24 +000039 */
Nils Diewaldbb33da22015-03-04 16:24:25 +000040 public CorpusDataException (int code, String message) {
Nils Diewald5c375702015-02-09 20:58:24 +000041 super(message);
Nils Diewaldbb33da22015-03-04 16:24:25 +000042 this.setErrorCode(code);
Nils Diewald5c375702015-02-09 20:58:24 +000043 };
44
45
46 /**
47 * Construct a new CorpusDataException.
Nils Diewaldbb33da22015-03-04 16:24:25 +000048 *
49 * @param message
50 * Exception message.
51 * @param cause
52 * A {@link Throwable} object.
Nils Diewald5c375702015-02-09 20:58:24 +000053 */
54 public CorpusDataException (String message, Throwable cause) {
55 super(message, cause);
56 };
57
58
59 /**
60 * Construct a new CorpusDataException.
Nils Diewaldbb33da22015-03-04 16:24:25 +000061 *
62 * @param cause
63 * A {@link Throwable} object.
64 */
Nils Diewald5c375702015-02-09 20:58:24 +000065 public CorpusDataException (Throwable cause) {
66 super(cause);
Nils Diewaldbb33da22015-03-04 16:24:25 +000067 };
68
Nils Diewald5c375702015-02-09 20:58:24 +000069
70 /**
71 * Get the error code of the exception.
Nils Diewaldbb33da22015-03-04 16:24:25 +000072 *
Nils Diewald5c375702015-02-09 20:58:24 +000073 * @return The error code of the exception as an integer.
74 */
Nils Diewaldbb33da22015-03-04 16:24:25 +000075 public int getErrorCode () {
Nils Diewald5c375702015-02-09 20:58:24 +000076 return this.errorCode;
77 };
78
79
80 /**
81 * Set the error code of the exception.
Nils Diewaldbb33da22015-03-04 16:24:25 +000082 *
83 * @param code
84 * The error code of the exception as an integer.
Nils Diewald5c375702015-02-09 20:58:24 +000085 */
86 public void setErrorCode (int code) {
87 this.errorCode = code;
88 };
89};