From: David ‘Bombe’ Roden Date: Fri, 8 Apr 2011 12:51:48 +0000 (+0200) Subject: Allow a command to throw an exception. X-Git-Tag: 0.6.5^2~39^2~49 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=35aeb7dde28426cb1b22c91d90444d95c22d4edc Allow a command to throw an exception. --- diff --git a/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java b/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java index a4284aa..07fb7a4 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java +++ b/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java @@ -39,8 +39,10 @@ public interface Command { * @param accessType * The access type * @return A reply to send back to the plugin + * @throws FcpException + * if an error processing the parameters occurs */ - public Reply execute(SimpleFieldSet parameters, Bucket data, AccessType accessType); + public Reply execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException; /** * The access type of the request. diff --git a/src/main/java/net/pterodactylus/sone/freenet/fcp/FcpInterface.java b/src/main/java/net/pterodactylus/sone/freenet/fcp/FcpInterface.java index 3657f8f..de8718f 100644 --- a/src/main/java/net/pterodactylus/sone/freenet/fcp/FcpInterface.java +++ b/src/main/java/net/pterodactylus/sone/freenet/fcp/FcpInterface.java @@ -81,8 +81,8 @@ public class FcpInterface { /* TODO - return error? */ return; } - Reply reply = command.execute(parameters, data, AccessType.values()[accessType]); try { + Reply reply = command.execute(parameters, data, AccessType.values()[accessType]); SimpleFieldSet replyParameters = reply.getReplyParameters(); replyParameters.putOverwrite("Identifier", identifier); if (reply.hasData()) { @@ -92,6 +92,8 @@ public class FcpInterface { } else { pluginReplySender.send(replyParameters); } + } catch (FcpException fe1) { + /* TODO - log, report */ } catch (PluginNotFoundException pnfe1) { /* TODO - log */ }