Java Exception to String getException(Exception e)

Here you can find the source of getException(Exception e)

Description

get Exception

License

Open Source License

Declaration

public static String getException(Exception e) 

Method Source Code

//package com.java2s;
/*//from  w  ww . ja v a2 s.co  m
 This file is part of smpte2022lib.

 This project is free software: you can redistribute it and/or modify it under the terms of the EUPL v. 1.1 as provided
 by the European Commission. This project 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 European Union Public License for more details.

 You should have received a copy of the EUPL General Public License along with this project.
 If not, see he EUPL licence v1.1 is available in 22 languages:
 22-07-2013, <https://joinup.ec.europa.eu/software/page/eupl/licence-eupl>

 Retrieved from https://github.com/davidfischer-ch/smpte2022lib.git
 */

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

public class Main {
    public static String getException(Exception e) {
        // FIXME method's parameters validation (not null, ...)
        StringWriter w = new StringWriter();
        e.printStackTrace(new PrintWriter(w));
        return w.toString();
    }
}

Related

  1. exceptionTypeAndMsg(Exception e)
  2. exceptionWithCause(T exception, Throwable cause)
  3. getErrorMessage(Exception ex)
  4. getErrorMessage(Exception ex)
  5. getErrorMessage(Process process)
  6. getExceptionDetails(Exception e)
  7. getExceptionMessage(Exception e)
  8. getExceptionMessage(Exception ex)
  9. getExceptionMessage(Exception ex)