From c3892dde184485ab38eee0d176c930ab3ca465ee Mon Sep 17 00:00:00 2001
From: brinn <brinn>
Date: Wed, 25 Feb 2009 20:33:18 +0000
Subject: [PATCH] change: improve error message (better meaning for user)

SVN: 9988
---
 .../common/exceptions/MasqueradingException.java    | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/common/source/java/ch/systemsx/cisd/common/exceptions/MasqueradingException.java b/common/source/java/ch/systemsx/cisd/common/exceptions/MasqueradingException.java
index 9f9cc990603..b5546943058 100644
--- a/common/source/java/ch/systemsx/cisd/common/exceptions/MasqueradingException.java
+++ b/common/source/java/ch/systemsx/cisd/common/exceptions/MasqueradingException.java
@@ -39,11 +39,19 @@ public final class MasqueradingException extends RuntimeException
      */
     private final String rootExceptionClassName;
 
-    public MasqueradingException(final Exception rootException)
+    private final String prefix;
+
+    public MasqueradingException(final Exception rootException, final String prefix)
     {
         super(rootException.getMessage());
         setStackTrace(rootException.getStackTrace());
         rootExceptionClassName = rootException.getClass().getName();
+        this.prefix = prefix;
+    }
+
+    public MasqueradingException(final Exception rootException)
+    {
+        this(rootException, "Error occurred on server");
     }
 
     public final String getRootExceptionClassName()
@@ -58,7 +66,8 @@ public final class MasqueradingException extends RuntimeException
     @Override
     public final String toString()
     {
-        final String s = getClass().getSimpleName() + "(" + rootExceptionClassName + ")";
+        System.err.println("Prefix is " + prefix);
+        final String s = prefix + " [" + rootExceptionClassName + "]";
         final String message = getMessage();
         return (message != null) ? (s + ": " + message) : s;
     }
-- 
GitLab