Allow a command to throw an exception.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 8 Apr 2011 12:51:48 +0000 (14:51 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 8 Apr 2011 12:51:48 +0000 (14:51 +0200)
src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java
src/main/java/net/pterodactylus/sone/freenet/fcp/FcpInterface.java

index a4284aa..07fb7a4 100644 (file)
@@ -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.
index 3657f8f..de8718f 100644 (file)
@@ -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 */
                }