File: BeagleException.java

package info (click to toggle)
libhmsbeagle 4.0.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 46,424 kB
  • sloc: xml: 133,356; cpp: 36,477; ansic: 5,842; java: 2,400; python: 643; sh: 342; makefile: 50
file content (37 lines) | stat: -rw-r--r-- 1,019 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package beagle;

/**
 * @author Andrew Rambaut
 * @author Marc Suchard
 */
public class BeagleException extends RuntimeException {
    public BeagleException(String functionName, int errCode) {
        this.functionName = functionName;
        this.errCode = errCode;        
    }

    @Override
    public String getMessage() {
        BeagleErrorCode code = null;
        for (BeagleErrorCode c : BeagleErrorCode.values()) {
            if (c.getErrCode() == errCode) {
                code = c;
            }
        }
        if (code == null) {
            return "BEAGLE function, " + functionName + ", returned error code " + errCode + " (unrecognized error code)";
        }
        return "BEAGLE function, " + functionName + ", returned error code " + errCode + " (" + code.getMeaning() + ")";
    }

    public String getFunctionName() {
        return functionName;
    }

    public int getErrCode() {
        return errCode;
    }

    private final String functionName;
    private final int errCode;
}