mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-29 09:13:39 +01:00
Allow putting a user string in reported java exceptions
This commit is contained in:
1 parent
9d877106d7
commit
bc35c3341f
4 files changed
+21
-17
No files matched your search
+4
-4
@@ -801,19 +801,19 @@ void SystemInfoScreen::CreateTabs() {
|
||||
|
||||
internals->Add(new ItemHeader(si->T("Notification tests")));
|
||||
internals->Add(new Choice(si->T("Error")))->OnClick.Add([&](UI::EventParams &) {
|
||||
g_OSD.Show(OSDType::MESSAGE_ERROR, si->T("Error"));
|
||||
g_OSD.Show(OSDType::MESSAGE_ERROR, "Error");
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
internals->Add(new Choice(si->T("Warning")))->OnClick.Add([&](UI::EventParams &) {
|
||||
g_OSD.Show(OSDType::MESSAGE_WARNING, si->T("Warning"), "Some\nAdditional\nDetail");
|
||||
g_OSD.Show(OSDType::MESSAGE_WARNING, "Warning", "Some\nAdditional\nDetail");
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
internals->Add(new Choice(si->T("Info")))->OnClick.Add([&](UI::EventParams &) {
|
||||
g_OSD.Show(OSDType::MESSAGE_INFO, si->T("Info"));
|
||||
g_OSD.Show(OSDType::MESSAGE_INFO, "Info");
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
internals->Add(new Choice(si->T("Success")))->OnClick.Add([&](UI::EventParams &) {
|
||||
g_OSD.Show(OSDType::MESSAGE_SUCCESS, si->T("Success"));
|
||||
g_OSD.Show(OSDType::MESSAGE_SUCCESS, "Success");
|
||||
return UI::EVENT_DONE;
|
||||
});
|
||||
internals->Add(new ItemHeader(si->T("Progress tests")));
|
||||
|
||||
@@ -1038,7 +1038,7 @@ void System_Notify(SystemNotification notification) {
|
||||
PushCommand("sustainedPerfMode", "");
|
||||
break;
|
||||
case SystemNotification::TEST_JAVA_EXCEPTION:
|
||||
PushCommand("testException", "");
|
||||
PushCommand("testException", "This is a test exception");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -428,7 +428,7 @@ public abstract class NativeActivity extends Activity {
|
||||
additionalStorageDirs = s.toString();
|
||||
}
|
||||
catch (Exception e) {
|
||||
NativeApp.reportException(e);
|
||||
NativeApp.reportException(e, null);
|
||||
Log.e(TAG, "Failed to get SD storage dirs: " + e.toString());
|
||||
}
|
||||
|
||||
@@ -1161,7 +1161,7 @@ public abstract class NativeActivity extends Activity {
|
||||
NativeApp.sendRequestResult(imageRequestId, false, "", 0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
NativeApp.reportException(e);
|
||||
NativeApp.reportException(e, null);
|
||||
Log.w(TAG, "Exception receiving image: " + e);
|
||||
}
|
||||
imageRequestId = -1;
|
||||
@@ -1180,7 +1180,7 @@ public abstract class NativeActivity extends Activity {
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Exception getting permissions for document: " + e.toString());
|
||||
NativeApp.sendRequestResult(fileRequestId, false, "", 0);
|
||||
NativeApp.reportException(e);
|
||||
NativeApp.reportException(e, selectedFile.toString());
|
||||
fileRequestId = -1;
|
||||
return;
|
||||
}
|
||||
@@ -1205,7 +1205,7 @@ public abstract class NativeActivity extends Activity {
|
||||
getContentResolver().takePersistableUriPermission(selectedDirectoryUri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
NativeApp.reportException(e);
|
||||
NativeApp.reportException(e, selectedDirectoryUri.toString());
|
||||
Log.w(TAG, "Exception getting permissions for document: " + e.toString());
|
||||
// Intentionally don't return - see below.
|
||||
}
|
||||
@@ -1349,7 +1349,7 @@ public abstract class NativeActivity extends Activity {
|
||||
startActivity(i);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
NativeApp.reportException(e);
|
||||
NativeApp.reportException(e, params);
|
||||
// No browser?
|
||||
Log.e(TAG, e.toString());
|
||||
return false;
|
||||
@@ -1366,7 +1366,7 @@ public abstract class NativeActivity extends Activity {
|
||||
startActivity(Intent.createChooser(send, "E-mail the app author!"));
|
||||
return true;
|
||||
} catch (Exception e) { // For example, android.content.ActivityNotFoundException
|
||||
NativeApp.reportException(e);
|
||||
NativeApp.reportException(e, params);
|
||||
Log.e(TAG, e.toString());
|
||||
return false;
|
||||
}
|
||||
@@ -1378,7 +1378,7 @@ public abstract class NativeActivity extends Activity {
|
||||
startActivityForResult(i, RESULT_LOAD_IMAGE);
|
||||
return true;
|
||||
} catch (Exception e) { // For example, android.content.ActivityNotFoundException
|
||||
NativeApp.reportException(e);
|
||||
NativeApp.reportException(e, params);
|
||||
imageRequestId = -1;
|
||||
Log.e(TAG, e.toString());
|
||||
return false;
|
||||
@@ -1396,7 +1396,7 @@ public abstract class NativeActivity extends Activity {
|
||||
startActivityForResult(intent, RESULT_OPEN_DOCUMENT);
|
||||
// intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, pickerInitialUri);
|
||||
} catch (Exception e) {
|
||||
NativeApp.reportException(e);
|
||||
NativeApp.reportException(e, params);
|
||||
fileRequestId = -1;
|
||||
Log.e(TAG, e.toString());
|
||||
return false;
|
||||
@@ -1412,7 +1412,7 @@ public abstract class NativeActivity extends Activity {
|
||||
startActivityForResult(intent, RESULT_OPEN_DOCUMENT_TREE);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
NativeApp.reportException(e);
|
||||
NativeApp.reportException(e, params);
|
||||
folderRequestId = -1;
|
||||
Log.e(TAG, e.toString());
|
||||
return false;
|
||||
@@ -1427,7 +1427,7 @@ public abstract class NativeActivity extends Activity {
|
||||
startActivity(shareIntent);
|
||||
return true;
|
||||
} catch (Exception e) { // For example, android.content.ActivityNotFoundException
|
||||
NativeApp.reportException(e);
|
||||
NativeApp.reportException(e, params);
|
||||
Log.e(TAG, e.toString());
|
||||
return false;
|
||||
}
|
||||
@@ -1579,7 +1579,7 @@ public abstract class NativeActivity extends Activity {
|
||||
try {
|
||||
throw new Exception();
|
||||
} catch (Exception e) {
|
||||
NativeApp.reportException(e);
|
||||
NativeApp.reportException(e, params);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -60,8 +60,12 @@ public class NativeApp {
|
||||
public static native void pushCameraImageAndroid(byte[] image);
|
||||
|
||||
// Wrappers
|
||||
public static void reportException(Exception e) {
|
||||
public static void reportException(Exception e, String data) {
|
||||
String str = e.toString() + "\n" + e.getMessage() + "\n";
|
||||
if (data != null) {
|
||||
str += data + "\n";
|
||||
}
|
||||
// could also use import android.util.Log; String stackTrace = Log.getStackTraceString(exception);
|
||||
int count = 0;
|
||||
for (StackTraceElement ste : e.getStackTrace()) {
|
||||
str += ste + "\n";
|
||||
|
||||
Reference in new issue
Block a user