| Nils Diewald | 5c37570 | 2015-02-09 20:58:24 +0000 | [diff] [blame] | 1 | package de.ids_mannheim.korap.util; |
| 2 | |
| 3 | /** |
| 4 | * Exception class for corpus data processing problems. |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 5 | * |
| Nils Diewald | 5c37570 | 2015-02-09 20:58:24 +0000 | [diff] [blame] | 6 | * @author diewald |
| 7 | */ |
| 8 | public class CorpusDataException extends Exception { |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 9 | |
| Nils Diewald | 5c37570 | 2015-02-09 20:58:24 +0000 | [diff] [blame] | 10 | private int errorCode = 0; |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 11 | |
| 12 | |
| Nils Diewald | 5c37570 | 2015-02-09 20:58:24 +0000 | [diff] [blame] | 13 | /** |
| 14 | * Construct a new CorpusDataException. |
| 15 | */ |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 16 | public CorpusDataException () { |
| Nils Diewald | 5c37570 | 2015-02-09 20:58:24 +0000 | [diff] [blame] | 17 | super(); |
| 18 | }; |
| 19 | |
| 20 | |
| 21 | /** |
| 22 | * Construct a new CorpusDataException. |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 23 | * |
| 24 | * @param message |
| 25 | * Exception message. |
| Nils Diewald | 5c37570 | 2015-02-09 20:58:24 +0000 | [diff] [blame] | 26 | */ |
| 27 | public CorpusDataException (String message) { |
| 28 | super(message); |
| 29 | }; |
| 30 | |
| 31 | |
| 32 | /** |
| 33 | * Construct a new CorpusDataException. |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 34 | * |
| 35 | * @param code |
| 36 | * An integer value as an error code. |
| 37 | * @param message |
| 38 | * Exception message. |
| Nils Diewald | 5c37570 | 2015-02-09 20:58:24 +0000 | [diff] [blame] | 39 | */ |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 40 | public CorpusDataException (int code, String message) { |
| Nils Diewald | 5c37570 | 2015-02-09 20:58:24 +0000 | [diff] [blame] | 41 | super(message); |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 42 | this.setErrorCode(code); |
| Nils Diewald | 5c37570 | 2015-02-09 20:58:24 +0000 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | |
| 46 | /** |
| 47 | * Construct a new CorpusDataException. |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 48 | * |
| 49 | * @param message |
| 50 | * Exception message. |
| 51 | * @param cause |
| 52 | * A {@link Throwable} object. |
| Nils Diewald | 5c37570 | 2015-02-09 20:58:24 +0000 | [diff] [blame] | 53 | */ |
| 54 | public CorpusDataException (String message, Throwable cause) { |
| 55 | super(message, cause); |
| 56 | }; |
| 57 | |
| 58 | |
| 59 | /** |
| 60 | * Construct a new CorpusDataException. |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 61 | * |
| 62 | * @param cause |
| 63 | * A {@link Throwable} object. |
| 64 | */ |
| Nils Diewald | 5c37570 | 2015-02-09 20:58:24 +0000 | [diff] [blame] | 65 | public CorpusDataException (Throwable cause) { |
| 66 | super(cause); |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 67 | }; |
| 68 | |
| Nils Diewald | 5c37570 | 2015-02-09 20:58:24 +0000 | [diff] [blame] | 69 | |
| 70 | /** |
| 71 | * Get the error code of the exception. |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 72 | * |
| Nils Diewald | 5c37570 | 2015-02-09 20:58:24 +0000 | [diff] [blame] | 73 | * @return The error code of the exception as an integer. |
| 74 | */ |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 75 | public int getErrorCode () { |
| Nils Diewald | 5c37570 | 2015-02-09 20:58:24 +0000 | [diff] [blame] | 76 | return this.errorCode; |
| 77 | }; |
| 78 | |
| 79 | |
| 80 | /** |
| 81 | * Set the error code of the exception. |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 82 | * |
| 83 | * @param code |
| 84 | * The error code of the exception as an integer. |
| Nils Diewald | 5c37570 | 2015-02-09 20:58:24 +0000 | [diff] [blame] | 85 | */ |
| 86 | public void setErrorCode (int code) { |
| 87 | this.errorCode = code; |
| 88 | }; |
| 89 | }; |