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