another small exception-change
authoridfx <idfx>
Thu, 9 May 2002 14:23:09 +0000 (14:23 +0000)
committeridfx <idfx>
Thu, 9 May 2002 14:23:09 +0000 (14:23 +0000)
source/mir/util/ParameterExpander.java

index bb677d7..63a2733 100755 (executable)
@@ -1,5 +1,8 @@
 package  mir.util;
 
+import multex.Failure;
+import multex.Exc;
+
 import java.util.*;
 
 public class ParameterExpander {
@@ -49,7 +52,7 @@ public class ParameterExpander {
       location = location + part;
 
       if (node == null) {
-        throw new Exception( "Can't expand key " + aKey + ": "+ location + " does not exist" );
+        throw new ParameterExpanderExc( "Can't expand key {1}: {2} does not exist", new Object[]{aKey,location} );
       }
     }
 
@@ -58,7 +61,7 @@ public class ParameterExpander {
     }
 
     if (!(node instanceof String))
-      throw new Exception( "Can't expand key " + aKey + ": "+ location + " is not a string but a " + node.getClass().getName() );
+      throw new ParameterExpanderExc( "Can't expand key {1}: {2} is not a string but a {3}", new Object[]{aKey,location,node.getClass().getName()} );
 
     return (String) node;
   }
@@ -85,7 +88,7 @@ public class ParameterExpander {
             previousPosition=endOfNamePosition+1;
           }
           else {
-              throw new Exception("Missing } in " + anExpression);
+            throw new ParameterExpanderExc("Missing } in {1}",new Object[]{anExpression});
           }
         }
         else
@@ -99,6 +102,12 @@ public class ParameterExpander {
 
     return result.toString();
   }
+
+  public static class ParameterExpanderExc extends Exc {
+    public ParameterExpanderExc(String msg, Object[] objects) {
+      super(msg, objects);
+    }
+  }
 }