Here you can find the source of getExceptionDetails(Throwable throwable)
Parameter | Description |
---|---|
throwable | a Throwable object. |
public final static String getExceptionDetails(Throwable throwable)
//package com.java2s; /******************************************************************************* * * Copyright (c) 2002, 2008 IBM Corporation, Beacon Information Technology Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from ww w . j ava 2 s .c o m*/ * IBM - Initial API and implementation * BeaconIT - Initial API and implementation *******************************************************************************/ import java.io.PrintWriter; import java.io.StringWriter; public class Main { /** * Get exception information as a string. * @param throwable a Throwable object. * @return exception information as a string. */ public final static String getExceptionDetails(Throwable throwable) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); pw.println("Exception: "); throwable.printStackTrace(pw); return sw.toString(); } }