xref: /aosp_15_r20/external/fbjni/java/com/facebook/jni/ExceptionHelper.java (revision 65c59e023c5336bbd4a23be7af78407e3d80e7e7)
1*65c59e02SInna Palant /*
2*65c59e02SInna Palant  * Copyright (c) Facebook, Inc. and its affiliates.
3*65c59e02SInna Palant  *
4*65c59e02SInna Palant  * Licensed under the Apache License, Version 2.0 (the "License");
5*65c59e02SInna Palant  * you may not use this file except in compliance with the License.
6*65c59e02SInna Palant  * You may obtain a copy of the License at
7*65c59e02SInna Palant  *
8*65c59e02SInna Palant  *     http://www.apache.org/licenses/LICENSE-2.0
9*65c59e02SInna Palant  *
10*65c59e02SInna Palant  * Unless required by applicable law or agreed to in writing, software
11*65c59e02SInna Palant  * distributed under the License is distributed on an "AS IS" BASIS,
12*65c59e02SInna Palant  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*65c59e02SInna Palant  * See the License for the specific language governing permissions and
14*65c59e02SInna Palant  * limitations under the License.
15*65c59e02SInna Palant  */
16*65c59e02SInna Palant 
17*65c59e02SInna Palant package com.facebook.jni;
18*65c59e02SInna Palant 
19*65c59e02SInna Palant import com.facebook.jni.annotations.DoNotStrip;
20*65c59e02SInna Palant import java.io.PrintWriter;
21*65c59e02SInna Palant import java.io.StringWriter;
22*65c59e02SInna Palant 
23*65c59e02SInna Palant @DoNotStrip
24*65c59e02SInna Palant class ExceptionHelper {
25*65c59e02SInna Palant   @DoNotStrip
getErrorDescription(Throwable throwable)26*65c59e02SInna Palant   private static String getErrorDescription(Throwable throwable) {
27*65c59e02SInna Palant     final StringWriter stringWriter = new StringWriter();
28*65c59e02SInna Palant     throwable.printStackTrace(new PrintWriter(stringWriter));
29*65c59e02SInna Palant     return stringWriter.toString();
30*65c59e02SInna Palant   }
31*65c59e02SInna Palant }
32