Programming Tips πŸ’‘
51.5K subscribers
67 photos
10 videos
30 files
354 links
Programming & AI:
Tips πŸ’‘
Articles πŸ“•
Resources πŸ‘Ύ
Design Patterns πŸ’Ž
Software Principles βœ…

πŸ‡³πŸ‡± Contact: @MoienTajik

🎯 Buy ads: https://telega.io/c/ProgrammingTip
Download Telegram
πŸ“¦ Grab The Stack Trace Of An Exception πŸ“¦

Checking your code for errors is one of the most Painstaking – and frustrating – parts of the development process. πŸ™†πŸ»β€β™‚οΈ

It’s also horrendously Time-Consuming, particularly if you’ve a pesky error whose source isn’t immediately clear. πŸ’‘

Using this code, you can more easily track down where an Exception is occurring – and bring yourself that much closer to being rid of it. βœ…

Code
Exception e = …;
java.io.StringWriter sw = new java.io.StringWriter();
e.printStackTrace(new java.io.PrintWriter(sw));
String trace = sw.getBuffer().toString();


#java #exception #error #trick
@ProgrammingTip