From f20cdee888b418738a5019c3545c32713b3d1154 Mon Sep 17 00:00:00 2001 From: Konloch Date: Wed, 2 Oct 2024 13:51:52 -0600 Subject: [PATCH] Created Exception Utils --- .../bytecodeviewer/util/ExceptionUtils.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/main/java/the/bytecode/club/bytecodeviewer/util/ExceptionUtils.java diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/ExceptionUtils.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/ExceptionUtils.java new file mode 100644 index 00000000..a05d2e1b --- /dev/null +++ b/src/main/java/the/bytecode/club/bytecodeviewer/util/ExceptionUtils.java @@ -0,0 +1,20 @@ +package the.bytecode.club.bytecodeviewer.util; + +import java.io.PrintWriter; +import java.io.StringWriter; + +/** + * @author Konloch + * @since 10/2/2024 + */ +public class ExceptionUtils +{ + public static String exceptionToString(Throwable e) + { + StringWriter exceptionWriter = new StringWriter(); + e.printStackTrace(new PrintWriter(exceptionWriter)); + e.printStackTrace(); + + return exceptionWriter.toString(); + } +}