on 01-16-2008 10:34 AM
Hi forum,
I want to show an exception message in 3 lines as follows in my project ie 1st line print :Error occured while proccessing
2nd line: error code
3rd line:error stack trace:(exception)
I tried using the new line character ie
wdThis
.wdGetAPI()
.getComponent()
.getMessageManager()
.reportException("Problem occured while processing Agency Fee. Please contact the System Administrator.""\r\n"exceptionId"\r\nStack Trace:"exception,false);
but this is not working. Is there possible way to do this?
Else another alternate would be printing 3 report exception but it will contain 3 error symbols for one error message.
Thanks & Regards
Jaspreet Kaur Grewal
Hi jaspreet,
try using StackTraceElement for this. get the Array of StackTraceElement from the exception & print that in a loop. So u can append ur custom message also with the exception
StackTraceElement[] stack = ex.getStackTrace();
regards
Sumit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
I think this simple function below will be useful to you:
public static String stackTraceToString(Throwable th){
StringWriter strWr = new StringWriter();
PrintWriter prWr = new PrintWriter(strWr);
th.printStackTrace(prWr);
strWr.flush();
prWr.flush();
return strWr.toString();
}
Regards,
Andrzej
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.