summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java
diff options
context:
space:
mode:
authorSimon Rettberg2015-08-27 18:08:48 +0200
committerSimon Rettberg2015-08-27 18:08:48 +0200
commitac15c2a1cfe0fc0519b5577e7478c25500fe45c3 (patch)
treecdc93ee180fe17220c8a193fff73238e9ddcc651 /dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java
parentMerge branch 'v1.1' of git.openslx.org:openslx-ng/tutor-module into v1.1 (diff)
downloadtutor-module-ac15c2a1cfe0fc0519b5577e7478c25500fe45c3.tar.gz
tutor-module-ac15c2a1cfe0fc0519b5577e7478c25500fe45c3.tar.xz
tutor-module-ac15c2a1cfe0fc0519b5577e7478c25500fe45c3.zip
[*] Thrift API changes
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java31
1 files changed, 28 insertions, 3 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java
index 73fffc37..6982f8e5 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftError.java
@@ -7,9 +7,10 @@ import javax.swing.SwingUtilities;
import org.apache.log4j.Logger;
import org.apache.thrift.TException;
import org.openslx.bwlp.thrift.iface.AuthorizationError;
+import org.openslx.bwlp.thrift.iface.InvocationError;
import org.openslx.bwlp.thrift.iface.TAuthorizationException;
-import org.openslx.bwlp.thrift.iface.TInternalServerError;
import org.openslx.bwlp.thrift.iface.TInvalidDateParam;
+import org.openslx.bwlp.thrift.iface.TInvocationException;
import org.openslx.bwlp.thrift.iface.TNotFoundException;
import org.openslx.bwlp.thrift.iface.TTransferRejectedException;
import org.openslx.dozmod.gui.Gui;
@@ -23,8 +24,9 @@ public class ThriftError {
} else if (ex instanceof TAuthorizationException) {
String reason = getString(((TAuthorizationException) ex).getNumber());
messageText += "\n\nZugriff verweigert: " + reason + "\n" + ex.getMessage();
- } else if (ex instanceof TInternalServerError) {
- messageText += "\n\nEin serverseitiger Fehler ist aufgetreten. Bitte kontaktieren Sie den lokalen Support.";
+ } else if (ex instanceof TInvocationException) {
+ messageText += "\n\nDer Funktionsaufruf konnte nicht durchgeführt werden: "
+ + getString(((TInvocationException) ex).getNumber()) + "\n" + ex.getMessage();
} else if (ex instanceof TInvalidDateParam) {
messageText += "\n\nEin angegebenes Datum ist ungültig:\n" + ex.getMessage();
} else if (ex instanceof TTransferRejectedException) {
@@ -46,6 +48,29 @@ public class ThriftError {
});
}
+ private static String getString(InvocationError error) {
+ if (error == null)
+ return "Interner serverseitiger Fehler";
+ switch (error) {
+ case INTERNAL_SERVER_ERROR:
+ return "Interner serverseitiger Fehler";
+ case INVALID_DATA:
+ return "Ein Parameter hat einen ungültigen Wert";
+ case INVALID_SHARE_MODE:
+ return "Ungültiger Share-Mode";
+ case MISSING_DATA:
+ return "Ein Parameter fehlt (null?)";
+ case UNKNOWN_IMAGE:
+ return "Unbekanntes Image";
+ case UNKNOWN_LECTURE:
+ return "Unbekannte Veranstaltung";
+ case UNKNOWN_USER:
+ return "Unbekannter Benutzer";
+ default:
+ return "Unbekannter Fehlercode: " + error.toString();
+ }
+ }
+
public static String getString(AuthorizationError error) {
if (error == null)
return "(AuthorizationError=null)";