Skip to content
Snippets Groups Projects
Commit c3892dde authored by brinn's avatar brinn
Browse files

change: improve error message (better meaning for user)

SVN: 9988
parent 1f07774f
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment