Programming Tips - Java: make a exception look nicer before showing it to users.

Date: 2019jun20 Language: Java Q. Java: make a exception look nicer before showing it to users. A.
/** ex.toString() gives "java.io.FileNotFoundException <msg>" while this gives "FileNotFound <msg>" */ String prettyException(final Exception ex) { String name = ex.getClass().getSimpleName(); name = name.replace("Exception", ""); return name + " " + ex.getMessage(); }