Java Error Print printError(Class c, String m, Exception e)

Here you can find the source of printError(Class c, String m, Exception e)

Description

print Error

License

Open Source License

Declaration

public static void printError(Class<?> c, String m, Exception e) 

Method Source Code

//package com.java2s;
//    it under the terms of the GNU General Public License as published by

public class Main {
    public static void printError(Class<?> c, String m, Exception e) {
        if (c != null) {
            System.err.println("<" + c.getCanonicalName() + "> Error: " + m);

            if (e != null) {
                System.err.print("<" + c.getCanonicalName() + "> ...caused by: ");

                e.printStackTrace();//from  w ww. jav  a  2 s. com
            }
        } else {
            System.err.println("Error: " + m);

            if (e != null) {
                System.err.print("...caused by: ");

                e.printStackTrace();
            }
        }
    }
}

Related

  1. printError(Object obj, String message)
  2. printError(String error)
  3. printError(String message)
  4. printError(String message, Exception e, boolean pst)