Add further unit tests.
[cfb.git] / prod / net / jaekl / cfb / store / StoreException.java
index 5b7544df70f54438d346389f60fab7f02e0eb252..b7d75816450814da88747a968314aa76e3dd4162 100644 (file)
@@ -1,11 +1,39 @@
 package net.jaekl.cfb.store;
 
+import java.util.Arrays;
+
 import net.jaekl.cfb.CfbException;
 
 public class StoreException extends CfbException {
+       public enum Type {
+               UNKNOWN_PATTERN,        // bug pattern type is not found in the message collection 
+               UNKNOWN_CATEGORY,       // bug category is not found in the message collection
+               INVALID_LOC_ID          // the specified location ID is not found in the database
+       }
+       
+       private Type m_type;
+       private String[] m_info;
+       
        private static final long serialVersionUID = 1L;
        
-       public StoreException(String msg) {
-               super(msg);
+       public StoreException(Type type, String... info) {
+               super();
+               
+               m_type = type;
+               m_info = info;
+       }
+       
+       public StoreException(Throwable cause, Type type, String... info) {
+               super(cause);
+               
+               m_type = type;
+               m_info = info;
+       }
+       
+       public Type getType() { return m_type; }
+       
+       @Override
+       public String toString() {
+               return "" + getClass().getName() + ": " + m_type + ": " + Arrays.toString(m_info);
        }
 }