From 27e1631b041bdd73f13afa836e9ee8c67f444d49 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Mon, 11 Sep 2023 11:05:18 +0200 Subject: [PATCH] fun fix & format --- flutter/lib/src/jvm/jvm_exception.dart | 3 +-- flutter/test/jvm/jvm_exception_test.dart | 4 ++-- flutter/test/sentry_navigator_observer_test.dart | 1 + sqflite/lib/src/sentry_database.dart | 15 +++++++++++---- sqflite/test/mocks/mocks.dart | 3 ++- sqflite/test/sentry_batch_test.dart | 8 ++++++-- sqflite/test/sentry_database_test.dart | 4 +++- 7 files changed, 26 insertions(+), 12 deletions(-) diff --git a/flutter/lib/src/jvm/jvm_exception.dart b/flutter/lib/src/jvm/jvm_exception.dart index eeb465522c..756f219b12 100644 --- a/flutter/lib/src/jvm/jvm_exception.dart +++ b/flutter/lib/src/jvm/jvm_exception.dart @@ -257,9 +257,8 @@ class JvmException { } final thisExceptionFrames = thisException + .where((line) => line.trim().isNotEmpty) .map((e) => JvmFrame.parse(e)) - .where( - (e) => e.originalFrame.isNotEmpty && e.originalFrame.trim() != 'at') .toList(growable: false); final suppressedExceptions = supressed diff --git a/flutter/test/jvm/jvm_exception_test.dart b/flutter/test/jvm/jvm_exception_test.dart index e5a2f4a222..de8a3b4e29 100644 --- a/flutter/test/jvm/jvm_exception_test.dart +++ b/flutter/test/jvm/jvm_exception_test.dart @@ -86,7 +86,7 @@ void main() { expect(exception.stackTrace[0].lineNumber, 292); }); - test('parse drops frames with `at ` and empty original frame', () { + test('parse drops empty frames', () { final exception = JvmException.parse(platformExceptionWithEmptyStackFrames); expect(exception.stackTrace.length, 13); expect(exception.stackTrace.last.className, @@ -220,5 +220,5 @@ java.lang.RuntimeException: Catch this platform exception! at java.lang.reflect.Method.invoke at com.android.internal.os.RuntimeInit\$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) - at + '''; diff --git a/flutter/test/sentry_navigator_observer_test.dart b/flutter/test/sentry_navigator_observer_test.dart index d3871b4390..d4c2499efc 100644 --- a/flutter/test/sentry_navigator_observer_test.dart +++ b/flutter/test/sentry_navigator_observer_test.dart @@ -756,6 +756,7 @@ class _MockHub extends MockHub { @override final options = SentryOptions(dsn: fakeDsn); + @override late final scope = Scope(options); @override diff --git a/sqflite/lib/src/sentry_database.dart b/sqflite/lib/src/sentry_database.dart index 71147c3464..d148eb7ded 100644 --- a/sqflite/lib/src/sentry_database.dart +++ b/sqflite/lib/src/sentry_database.dart @@ -58,8 +58,11 @@ class SentryDatabase extends SentryDatabaseExecutor implements Database { @internal Hub? hub, }) : _hub = hub ?? HubAdapter(), dbName = p.basenameWithoutExtension(_database.path), - super(_database, - hub: hub, dbName: p.basenameWithoutExtension(_database.path)) { + super( + _database, + hub: hub, + dbName: p.basenameWithoutExtension(_database.path), + ) { // ignore: invalid_use_of_internal_member final options = _hub.options; options.sdk.addIntegration('SentrySqfliteTracing'); @@ -132,8 +135,12 @@ class SentryDatabase extends SentryDatabaseExecutor implements Database { setDatabaseAttributeData(span, dbName); Future newAction(Transaction txn) async { - final executor = SentryDatabaseExecutor(txn, - parentSpan: span, hub: _hub, dbName: dbName); + final executor = SentryDatabaseExecutor( + txn, + parentSpan: span, + hub: _hub, + dbName: dbName, + ); final sentrySqfliteTransaction = SentrySqfliteTransaction(executor, hub: _hub, dbName: dbName); diff --git a/sqflite/test/mocks/mocks.dart b/sqflite/test/mocks/mocks.dart index 3f0af8274c..bcafb94302 100644 --- a/sqflite/test/mocks/mocks.dart +++ b/sqflite/test/mocks/mocks.dart @@ -34,7 +34,8 @@ ISentrySpan startTransactionShim( ], customMocks: [ MockSpec( - fallbackGenerators: {#startTransaction: startTransactionShim}), + fallbackGenerators: {#startTransaction: startTransactionShim}, + ), ], ) void main() {} diff --git a/sqflite/test/sentry_batch_test.dart b/sqflite/test/sentry_batch_test.dart index ce6f59e0d5..e3b24d811a 100644 --- a/sqflite/test/sentry_batch_test.dart +++ b/sqflite/test/sentry_batch_test.dart @@ -296,7 +296,9 @@ SELECT * FROM Product'''; final span = fixture.tracer.children.last; expect(span.data[SentryDatabase.dbSystemKey], SentryDatabase.dbSystem); expect( - span.data[SentryDatabase.dbNameKey], (db as SentryDatabase).dbName); + span.data[SentryDatabase.dbNameKey], + (db as SentryDatabase).dbName, + ); await db.close(); }); @@ -313,7 +315,9 @@ SELECT * FROM Product'''; final span = fixture.tracer.children.last; expect(span.data[SentryDatabase.dbSystemKey], SentryDatabase.dbSystem); expect( - span.data[SentryDatabase.dbNameKey], (db as SentryDatabase).dbName); + span.data[SentryDatabase.dbNameKey], + (db as SentryDatabase).dbName, + ); await db.close(); }); diff --git a/sqflite/test/sentry_database_test.dart b/sqflite/test/sentry_database_test.dart index e05bd2367c..5c954426bb 100644 --- a/sqflite/test/sentry_database_test.dart +++ b/sqflite/test/sentry_database_test.dart @@ -112,7 +112,9 @@ void main() { expect(insertSpan.context.parentSpanId, trSpan.context.spanId); expect(insertSpan.status, SpanStatus.ok()); expect( - insertSpan.data[SentryDatabase.dbSystemKey], SentryDatabase.dbSystem); + insertSpan.data[SentryDatabase.dbSystemKey], + SentryDatabase.dbSystem, + ); expect(insertSpan.data[SentryDatabase.dbNameKey], inMemoryDatabasePath); expect(