mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-27 21:16:48 +00:00
Sentry fix (#395)
* Extra sentry diagnostics * Fix unit test * Unit test updates * More unit test updates
This commit is contained in:
parent
6fe23fa846
commit
2babf27db5
@ -586,8 +586,8 @@ class APIFormField {
|
||||
});
|
||||
}
|
||||
|
||||
// Render a "related field" based on the "model" type
|
||||
Widget _renderRelatedField(dynamic item, bool selected, bool extended) {
|
||||
// Render a "related field" based on the "model" type
|
||||
|
||||
// Convert to JSON
|
||||
var data = Map<String, dynamic>.from((item ?? {}) as Map);
|
||||
|
@ -1,6 +1,7 @@
|
||||
import "dart:io";
|
||||
|
||||
import "package:device_info_plus/device_info_plus.dart";
|
||||
import "package:one_context/one_context.dart";
|
||||
import "package:package_info_plus/package_info_plus.dart";
|
||||
import "package:sentry_flutter/sentry_flutter.dart";
|
||||
|
||||
@ -148,7 +149,7 @@ Future<bool> sentryReportMessage(String message, {Map<String, String>? context})
|
||||
/*
|
||||
* Report an error message to sentry.io
|
||||
*/
|
||||
Future<void> sentryReportError(String source, dynamic error, dynamic stackTrace, {Map<String, String> context = const {}}) async {
|
||||
Future<void> sentryReportError(String source, dynamic error, StackTrace? stackTrace, {Map<String, String> context = const {}}) async {
|
||||
|
||||
print("----- Sentry Intercepted error: $error -----");
|
||||
print(stackTrace);
|
||||
@ -192,6 +193,15 @@ Future<void> sentryReportError(String source, dynamic error, dynamic stackTrace,
|
||||
// Ensure we pass the 'source' of the error
|
||||
context["source"] = source;
|
||||
|
||||
if (OneContext.hasContext) {
|
||||
final ctx = OneContext().context;
|
||||
|
||||
if (ctx != null) {
|
||||
context["widget"] = ctx.widget.toString();
|
||||
context["widgetType"] = ctx.widget.runtimeType.toString();
|
||||
}
|
||||
}
|
||||
|
||||
Sentry.configureScope((scope) {
|
||||
scope.setExtra("server", server_info);
|
||||
scope.setExtra("app", app_info);
|
||||
|
@ -38,6 +38,8 @@ Future<void> main() async {
|
||||
options.dsn = SENTRY_DSN_KEY;
|
||||
options.release = release;
|
||||
options.environment = isInDebugMode() ? "debug" : "release";
|
||||
options.diagnosticLevel = SentryLevel.debug;
|
||||
options.attachStacktrace = true;
|
||||
});
|
||||
|
||||
// Pass any flutter errors off to the Sentry reporting context!
|
||||
|
@ -98,7 +98,7 @@ class UserProfileDBManager {
|
||||
|
||||
if (exists) {
|
||||
debug("addProfile() : UserProfile '${profile.name}' already exists");
|
||||
return false;
|
||||
return true;
|
||||
} else {
|
||||
debug("Adding new profile: '${profile.name}'");
|
||||
}
|
||||
@ -137,6 +137,8 @@ class UserProfileDBManager {
|
||||
* Remove a user profile from the database
|
||||
*/
|
||||
Future<void> deleteProfile(UserProfile profile) async {
|
||||
debug("deleteProfile: ${profile.name}");
|
||||
|
||||
await store.record(profile.key).delete(await _db);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ void main() {
|
||||
final prf = await UserProfileDBManager().getProfileByName("Test Profile");
|
||||
|
||||
if (prf != null) {
|
||||
UserProfileDBManager().deleteProfile(prf);
|
||||
await UserProfileDBManager().deleteProfile(prf);
|
||||
}
|
||||
|
||||
bool result = await UserProfileDBManager().addProfile(
|
||||
|
@ -79,7 +79,7 @@ void main() {
|
||||
)
|
||||
);
|
||||
|
||||
expect(result, equals(false));
|
||||
expect(result, equals(true));
|
||||
|
||||
// Check that the number of protocols available is still the same
|
||||
var profiles = await UserProfileDBManager().getAllProfiles();
|
||||
|
Loading…
x
Reference in New Issue
Block a user