[Webfunds-commits] java/webfunds/sox Errors.java

Ian Grigg iang@cypherpunks.ai
Sun, 16 Jul 2000 15:33:39 -0400 (AST)


iang        00/07/16 15:33:39

  Modified:    webfunds/sox Errors.java
  Log:
  cleanup, separated out validity test so that other code could use it

Revision  Changes    Path
1.14      +23 -14    java/webfunds/sox/Errors.java

Index: Errors.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/Errors.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Errors.java	2000/06/10 18:31:32	1.13
+++ Errors.java	2000/07/16 19:33:39	1.14
@@ -1,5 +1,5 @@
 /*
- * $Id: Errors.java,v 1.13 2000/06/10 18:31:32 iang Exp $
+ * $Id: Errors.java,v 1.14 2000/07/16 19:33:39 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -19,7 +19,7 @@
     public static final int ERROR_GOOD                 = 0;  // no error here
 
     /**
-     * Lower Layers of SOX
+     *  Lower Layers of SOX
      */
     public static final int ERROR_REGISTERED_ALREADY   = 1; // not really error
     public static final int ERROR_UNKNOWN_REQUEST      = 2; // not supported?
@@ -31,15 +31,9 @@
 
 
     /**
-     * These are client level errors - DEPRECATED.
+     *  10-19 are transaction errors.
+     *  Passed up as an exception number.
      */
-    public static final int ERROR_UNKNOWN_ACCOUNT = 1;
-    public static final int ERROR_INSUF_FUNDS = 2;
-    // public static final int ERROR_PAYMENT_NOT_SIGNED = 3;  // moved to 31
-
-    /**
-     * 10-19 are transaction errors.
-     */
     public static final int ERROR_NO_FUNDS             = 10;
     public static final int ERROR_CANCELLED            = 11; // beaten by 0
     public static final int ERROR_DEP_CANCELLED        = 12; // beaten by 0
@@ -54,7 +48,7 @@
     public static final int ERROR_NOT_PERMITTED        = 20; // limited account
 
     /**
-     * 30-39 are bad arguments within a deposit or payment.
+     *  30-39 are bad arguments within a deposit or payment.
      */
     public static final int ERROR_NOT_A_PAYMENT        = 30;
     public static final int ERROR_PAYMENT_NOT_SIGNED   = 31;
@@ -69,15 +63,18 @@
 
 
     /**
-     * 50-59 are Mail errors.
+     *  50-59 are Mail errors.
      */
     public static final int ERROR_NOT_MAIL_SIG         = 50;
 
     /**
-     * Old AccountsClient.pm errors.
+     *  Old AccountsClient.pm errors.  Still seem to be in use.
      */
     public static final int ERROR_NO_SUCH_KHID         = 60;
     public static final int ERROR_NOT_A_KHID           = 62;
+    /**
+     *  These two are in use:
+     */
     public static final int ERROR_LATER                = 63;
     public static final int ERROR_BACKEND              = 64;
 
@@ -146,9 +143,21 @@
      * The non OO way of handling errors - get the string.
      * Maybe we should have an exception for each one.
      */
+    public static final boolean isSOXError(int errno)
+    {
+         if ( (0 <= errno) && (errno < errors.length) )
+             return true ;
+
+         return false ;
+    }
+    
+    /**
+     * The non OO way of handling errors - get the string.
+     * Maybe we should have an exception for each one.
+     */
     public static final String errorString(int errno)
     {
-         if ( ! (0 <= errno && errno < errors.length) )
+         if (!isSOXError(errno))
              return "unknown SOX error";
 
          return errors[errno];