From f54628c2ba855bc089bb82c79ee2ac889f124723 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Mon, 1 Oct 2001 23:06:23 +0000 Subject: [PATCH] Added a ServiceFailedException for use by invocation services. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@372 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../server/ServiceFailedException.java | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/java/com/threerings/presents/server/ServiceFailedException.java diff --git a/src/java/com/threerings/presents/server/ServiceFailedException.java b/src/java/com/threerings/presents/server/ServiceFailedException.java new file mode 100644 index 000000000..05e39741c --- /dev/null +++ b/src/java/com/threerings/presents/server/ServiceFailedException.java @@ -0,0 +1,45 @@ +// +// $Id: ServiceFailedException.java,v 1.1 2001/10/01 23:06:23 mdb Exp $ + +package com.threerings.cocktail.cher.server; + +/** + * An exception class for use in concert with invocation services when + * they need to communicate a failure of some kind and can't use the + * return value. + * + *

For example, consider an invitation service: + * + *

+ * public class fooManager
+ * {
+ *     // returns invitation id, throws ServiceFailedException if
+ *     // invitation couldn't be processed
+ *     public int invite (...)
+ *         throws ServiceFailedException
+ *     {
+ *     }
+ * }
+ *
+ * public class fooProvider
+ * {
+ *     public void handleInviteRequest (...)
+ *     {
+ *         try {
+ *             int inviteId = _mgr.invite(...);
+ *             sendResponse(..., INVITE_RECEIVED, new Integer(inviteId));
+ *
+ *         } catch (ServiceFailedException sfe) {
+ *             sendResponse(..., INVITE_FAILED, sfe.getMessage());
+ *         }
+ *     }
+ * }
+ * 
+ */ +public class ServiceFailedException extends Exception +{ + public ServiceFailedException (String message) + { + super(message); + } +}