Skip to content

Commit

Permalink
improve error report
Browse files Browse the repository at this point in the history
  • Loading branch information
ammarahm-ed committed Sep 30, 2023
1 parent e89eb8f commit 0d28b46
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 9 additions & 1 deletion test-app/app/src/debug/java/com/tns/ErrorReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,21 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa

int errorExceptionViewId = activity.getResources().getIdentifier("errorException", "id", activity.getPackageName());
TextView errorExceptionView = (TextView) activity.findViewById(errorExceptionViewId);
errorExceptionView.setMovementMethod(new ScrollingMovementMethod());

int errorStackTraceViewId = container.getContext().getResources().getIdentifier("errorStacktrace", "id", container.getContext().getPackageName());
TextView errorStackTraceView = (TextView) view.findViewById(errorStackTraceViewId);

String[] exceptionParts = exceptionMsg.split("StackTrace:");
String error = exceptionParts[0];
String trace = exceptionParts.length > 1 ? exceptionParts[1] : null;
String trace = "";

if (exceptionParts.length > 1) {
for (int i=0;i < exceptionParts.length;i++) {
if (i == 0) continue;
trace += exceptionParts[i];
}
}

errorExceptionView.setText(error.trim());

Expand Down
5 changes: 4 additions & 1 deletion test-app/app/src/debug/res/layout/error_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
android:layout_height="wrap_content"
android:text=""
android:background="@color/red"
android:textSize="17sp"
android:textSize="16sp"
android:paddingLeft="16dp"
android:textIsSelectable="true"
android:maxHeight="200dp"
android:scrollbars="vertical"
android:textColor="@color/white"
android:paddingVertical="10dp"
android:paddingRight="16dp" />
Expand Down

0 comments on commit 0d28b46

Please sign in to comment.