Java Throwable to String stacktraceError(Throwable e)

Here you can find the source of stacktraceError(Throwable e)

Description

Generate a string with all stacktrace error

License

MIT License

Parameter

Parameter Description
e Exception object

Return

String

Declaration

private static String stacktraceError(Throwable e) 

Method Source Code


//package com.java2s;
/*!//  w  w w .  j  a v a  2  s  .  c o  m
 * @(#) Hibernate Helper v2.1.0
 * https://github.com/diegoguevara/HibernateGenericDao
 * 
 * Hibernate Helper implemantation
 * 
 * Copyright 2012, Diego Guevara
 * Released under dual licensed under the MIT or GPL Version 2 licenses.
 *  
 * Creation Date: Jun.2010
 * Update Date  : Apr.2012
 */

import java.io.PrintWriter;
import java.io.StringWriter;

public class Main {
    /**
     * Generate a string with all stacktrace error
     * @param e Exception object
     * @return String
     */
    private static String stacktraceError(Throwable e) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        e.printStackTrace(pw);
        return sw.toString();
    }
}

Related

  1. stackTrace(Throwable th, String pattern)
  2. stackTrace(Throwable throwable)
  3. stackTraceAsString(final Throwable aError)
  4. stackTraceAsString(Throwable e)
  5. stackTraceAsString(Throwable throwable)
  6. stackTraceFor(final Throwable exception)
  7. stackTraceFromException(Throwable ex)
  8. stackTraceFromThrowable(Throwable throwable)
  9. stackTraceOf(Throwable e)