Fixed stack trace

This commit is contained in:
M66B 2023-12-14 08:00:43 +01:00
parent 8b0cb299c3
commit 9ffe3c0688
1 changed files with 13 additions and 0 deletions

View File

@ -24,6 +24,10 @@ import android.text.TextUtils;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
// TODO CASA // TODO CASA
public class ThrowableWrapper extends Throwable { public class ThrowableWrapper extends Throwable {
private String msg; private String msg;
@ -41,6 +45,10 @@ public class ThrowableWrapper extends Throwable {
ThrowableWrapper() { ThrowableWrapper() {
this.ex = new Throwable(); this.ex = new Throwable();
List<StackTraceElement> stack = new ArrayList<>(Arrays.asList(ex.getStackTrace()));
if (stack.size() > 0)
stack.remove(0);
ex.setStackTrace(stack.toArray(new StackTraceElement[0]));
} }
ThrowableWrapper(Throwable ex) { ThrowableWrapper(Throwable ex) {
@ -86,6 +94,11 @@ public class ThrowableWrapper extends Throwable {
return ex.getStackTrace(); return ex.getStackTrace();
} }
@Override
public void setStackTrace(@NonNull StackTraceElement[] stackTrace) {
ex.setStackTrace(stackTrace);
}
@Nullable @Nullable
@Override @Override
public synchronized Throwable getCause() { public synchronized Throwable getCause() {