File: LassoException_top.java

package info (click to toggle)
lasso 2.4.1-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 25,856 kB
  • ctags: 14,480
  • sloc: ansic: 66,107; xml: 23,958; sh: 11,365; python: 7,474; makefile: 1,526; java: 444; php: 325; perl: 117
file content (31 lines) | stat: -rw-r--r-- 1,158 bytes parent folder | download | duplicates (7)
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
package com.entrouvert.lasso;

public class LassoException extends RuntimeException {
    private static final long serialVersionUID = 6170037639785281128L;
    public int errorCode;
    private static boolean throws_for_recoverable_errors = true;
    /** If set to true, enables throwing of exception for
     * recoverable errors, i.e. errors with a positive error
     * code.
     *
     * @param bool true if exception are throwed on recoverable errors.
     */
    public static void setThrowsForRecoverableErrors(boolean bool) {
        throws_for_recoverable_errors = bool;
    }
    public static boolean getThrowsForRecoverableErrors() {
        return throws_for_recoverable_errors;
    }

    protected LassoException(int errorCode) {
        super(LassoJNI.strError(errorCode));
        this.errorCode = errorCode;
    }
    protected LassoException(int errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
    }
    protected static int throwError(int errorCode) throws LassoException {
            if (errorCode == 0 || (! throws_for_recoverable_errors && errorCode > 0))
                return errorCode;