diff options
author | Frederic Peters <fpeters@entrouvert.com> | 2008-04-29 12:06:30 +0000 |
---|---|---|
committer | Frederic Peters <fpeters@entrouvert.com> | 2008-04-29 12:06:30 +0000 |
commit | 3b93e1b952d046ca20459194e8ea649e1e0794bc (patch) | |
tree | d882a011f53ea0d7b53bcde22696d7d272bafa96 /bindings/java/LassoException_top.java | |
parent | 34e4fd0b5aae872344a16267efac847f45108ca7 (diff) | |
download | lasso-3b93e1b952d046ca20459194e8ea649e1e0794bc.tar.gz lasso-3b93e1b952d046ca20459194e8ea649e1e0794bc.tar.xz lasso-3b93e1b952d046ca20459194e8ea649e1e0794bc.zip |
[project @ fpeters@0d.be-20080217115557-8qtcrc1vzb75f75c]
merged Benjamin branch
Original author: Frederic Peters <fpeters@0d.be>
Date: 2008-02-17 12:55:57.088000+01:00
Diffstat (limited to 'bindings/java/LassoException_top.java')
-rw-r--r-- | bindings/java/LassoException_top.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/bindings/java/LassoException_top.java b/bindings/java/LassoException_top.java new file mode 100644 index 00000000..19b4d8e0 --- /dev/null +++ b/bindings/java/LassoException_top.java @@ -0,0 +1,31 @@ +package com.entrouvert.lasso; + +public class LassoException extends RuntimeException { + public int errorCode; + private static boolean throws_for_recoverable_errors = false; + /** 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)); + errorCode = errorCode; + } + protected LassoException(int errorCode, String message) { + super(message); + errorCode = errorCode; + } + private static final Class[] paramst = { Integer.class }; + protected static int throwError(int errorCode) throws LassoException { + if (errorCode == 0 || (! throws_for_recoverable_errors && errorCode > 0)) + return errorCode; + |