Java Exception Print printException(Exception e, String message)

Here you can find the source of printException(Exception e, String message)

Description

Prints an error message with the exception stacktrace to the console with the prefix
EXCEPTION!

License

Open Source License

Parameter

Parameter Description
e The catched exeption
message Helpful hints why exception was thrown

Declaration

public static void printException(Exception e, String message) 

Method Source Code

//package com.java2s;
/*//from   w  w w . jav  a2s  . c o m
 * Copyright (C) 2012 MineStar.de 
 * 
 * This file is part of MineStarLibrary.
 * 
 * MineStarLibrary is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 3 of the License.
 * 
 * MineStarLibrary is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with MineStarLibrary.  If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    /**
     * Prints an error message with the exception stacktrace to the console with
     * the prefix <br>
     * <code>EXCEPTION! </code>
     * 
     * @param e
     *            The catched exeption
     * @param message
     *            Helpful hints why exception was thrown
     */
    public static void printException(Exception e, String message) {
        printInfo("EXCEPTION! " + message);
    }

    /**
     * Prints an error message with the exception stacktrace to the console with
     * the prefix <br>
     * <code>[ PLUGIN ] : EXCEPTION! </code>
     * 
     * @param e
     *            The catched exeption
     * @param pluginName
     *            The name of the plugin
     * @param message
     *            Helpful hints why exception was thrown
     */
    public static void printException(Exception e, String pluginName, String message) {
        printInfo(pluginName, "EXCEPTION! " + message);
        e.printStackTrace();
    }

    /**
     * Prints an information to the console
     * 
     * @param message
     *            The information
     */
    public static void printInfo(String message) {
        System.out.println(message);
    }

    /**
     * Prints an information to the console with the prefix <br>
     * <code>[ PLUGIN ] :</code>
     * 
     * @param pluginName
     *            The name of the plugin
     * @param message
     *            The information
     */
    public static void printInfo(String pluginName, String message) {
        printInfo("[ " + pluginName + " ] : " + message);
    }
}

Related

  1. printException(Exception e)
  2. printException(Exception e)
  3. printException(Exception e)
  4. printException(String excption)
  5. printException(String prefix, Exception e)
  6. PrintException(StringBuilder Str, boolean HTML, Throwable T, boolean PrintCauseToo)
  7. printException(Throwable e, StackTraceElement[] trace)