string - Java only get Exception name without StackTrace -


how can exception name without getting stack trace?

i using exception.tostring() convert thrown exception string, want exception name likenullpointerexception , not entire stack trace.

how can solve this?

exception.getclass().getsimplename(); 

class#getsimplename()

note: not work in case if exception anonymous class (although have never seen anonymous exception in production code)


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -