Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions lib/core/database/mongodb_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:querya_desktop/core/security/ssh_tunnel_config.dart';
import 'package:querya_desktop/core/security/ssl_certificate_support.dart';
import 'package:querya_desktop/core/storage/connection_secrets_store.dart';
import 'package:querya_desktop/core/storage/local_db.dart';
import 'package:querya_desktop/core/util/log_ignored.dart';

/// MongoDB connection configuration and state.
class MongoConnection with SshTunnelHost {
Expand Down Expand Up @@ -368,7 +369,9 @@ class MongoConnection with SshTunnelHost {
_openedDbs.remove(databaseName);
try {
await existing.close();
} catch (_) {}
} catch (e) {
logIgnored('mongodb_connection', e);
}
}
return _openingDbs.putIfAbsent(databaseName, () async {
try {
Expand All @@ -379,7 +382,9 @@ class MongoConnection with SshTunnelHost {
} catch (_) {
try {
await db.close();
} catch (_) {}
} catch (e) {
logIgnored('mongodb_connection', e);
}
rethrow;
}
_openedDbs[databaseName] = db;
Expand Down Expand Up @@ -471,7 +476,9 @@ class MongoConnection with SshTunnelHost {
_openedDbs.remove(databaseName);
try {
await db.close();
} catch (_) {}
} catch (e) {
logIgnored('mongodb_connection', e);
}
if (identical(_db, db)) {
_db = null;
for (final other in _openedDbs.values) {
Expand Down
17 changes: 13 additions & 4 deletions lib/core/database/mysql_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:querya_desktop/core/security/ssh_tunnel_manager.dart';
import 'package:querya_desktop/core/security/ssl_certificate_support.dart';
import 'package:querya_desktop/core/storage/connection_secrets_store.dart';
import 'package:querya_desktop/core/storage/local_db.dart';
import 'package:querya_desktop/core/util/log_ignored.dart';

/// TLS policy from `ssl-mode` / `sslmode` / `ssl` on a MySQL URI.
enum MysqlSslMode {
Expand Down Expand Up @@ -212,7 +213,9 @@ class MysqlConnection with SshTunnelHost {
if (_conn != null && !_conn!.connected) {
try {
await _conn?.close();
} catch (_) {}
} catch (e) {
logIgnored('mysql_connection', e);
}
_conn = null;
}
final generation = _generation;
Expand Down Expand Up @@ -305,10 +308,14 @@ class MysqlConnection with SshTunnelHost {
if (identical(_conn, opened)) _conn = null;
try {
if (opened != null && opened.connected) await opened.close();
} catch (_) {}
} catch (e) {
logIgnored('mysql_connection', e);
}
try {
await openedHandle?.release();
} catch (_) {}
} catch (e) {
logIgnored('mysql_connection', e);
}
forgetSshTunnel(openedHandle);
throw StateError('The connection was closed while it was being opened');
}
Expand Down Expand Up @@ -560,7 +567,9 @@ class MysqlConnection with SshTunnelHost {
if (!join) {
try {
await execute('ROLLBACK');
} catch (_) {}
} catch (e) {
logIgnored('mysql_connection', e);
}
}
rethrow;
}
Expand Down
21 changes: 16 additions & 5 deletions lib/core/database/redis_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:querya_desktop/core/storage/connection_secrets_store.dart';
import 'package:querya_desktop/core/database/redis_bulk.dart';
import 'package:querya_desktop/core/storage/local_db.dart';
import 'package:redis/redis.dart' as redis;
import 'package:querya_desktop/core/util/log_ignored.dart';

/// First page / load-more size for hash, list, set, and zset editors.
const redisCollectionPageSize = 200;
Expand Down Expand Up @@ -181,7 +182,9 @@ class RedisConnection with SshTunnelHost {
if (_socket != null) {
try {
_socket?.destroy();
} catch (_) {}
} catch (e) {
logIgnored('redis_connection', e);
}
_socket = null;
_command = null;
_conn = null;
Expand Down Expand Up @@ -276,7 +279,9 @@ class RedisConnection with SshTunnelHost {
// a silent server): close it, or every failed try leaves one behind.
try {
socket?.destroy();
} catch (_) {}
} catch (e) {
logIgnored('redis_connection', e);
}
await releaseSshTunnel();
rethrow;
}
Expand Down Expand Up @@ -306,7 +311,9 @@ class RedisConnection with SshTunnelHost {
_socket = null;
try {
sock?.destroy();
} catch (_) {}
} catch (e) {
logIgnored('redis_connection', e);
}
final c = _conn;
_conn = null;
if (c != null && wasConnected) {
Expand Down Expand Up @@ -363,7 +370,9 @@ class RedisConnection with SshTunnelHost {
if (!isConnected) return;
try {
await sendCommand([readOnly ? 'READONLY' : 'READWRITE']);
} catch (_) {}
} catch (e) {
logIgnored('redis_connection', e);
}
}

void _assertWritable() {
Expand Down Expand Up @@ -927,7 +936,9 @@ class RedisConnectionTestFake extends RedisConnection {
if (c != null) {
try {
await c.close();
} catch (_) {}
} catch (e) {
logIgnored('redis_connection', e);
}
}
}

Expand Down
13 changes: 10 additions & 3 deletions lib/core/database/sqlite_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:querya_desktop/core/database/sql_table_target_extractor.dart';
import 'package:querya_desktop/core/database/sqlite_sql.dart';
import 'package:querya_desktop/core/database/table_schema_meta.dart';
import 'package:querya_desktop/core/storage/local_db.dart';
import 'package:querya_desktop/core/util/log_ignored.dart';

/// In-memory paths (`:memory:`) skip the missing-file check.
bool sqlitePathIsInMemory(String path) =>
Expand Down Expand Up @@ -275,7 +276,9 @@ class SqliteConnection {
if (!join) {
try {
await execute('ROLLBACK');
} catch (_) {}
} catch (e) {
logIgnored('sqlite_connection', e);
}
}
rethrow;
}
Expand Down Expand Up @@ -353,7 +356,9 @@ class SqliteConnection {
} catch (_) {
try {
await _db!.execute('DROP VIEW IF EXISTS $viewName');
} catch (_) {}
} catch (e) {
logIgnored('sqlite_connection', e);
}
}
}

Expand All @@ -362,7 +367,9 @@ class SqliteConnection {
if (target != null) {
try {
return await listColumnNames(table: target.tableName);
} catch (_) {}
} catch (e) {
logIgnored('sqlite_connection', e);
}
}

return const [];
Expand Down
13 changes: 10 additions & 3 deletions lib/core/extensions/extension_driver_session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'package:querya_desktop/core/sdui/sdui_tree_schema.dart';
import 'package:querya_desktop/core/storage/app_settings.dart';
import 'package:querya_desktop/core/storage/connection_secrets_store.dart';
import 'package:querya_desktop/core/storage/local_db.dart';
import 'package:querya_desktop/core/util/log_ignored.dart';

/// Owns [PluginRpcBridge] sessions for extension-backed connections.
class ExtensionDriverSession {
Expand Down Expand Up @@ -111,7 +112,9 @@ class ExtensionDriverSession {
} catch (e) {
try {
await bridge.shutdown();
} catch (_) {}
} catch (e) {
logIgnored('extension_driver_session', e);
}
rethrow;
}

Expand Down Expand Up @@ -142,12 +145,16 @@ class ExtensionDriverSession {
}
try {
await bridge.sendRequest('db.disconnect', {'connectionId': tempId});
} catch (_) {}
} catch (e) {
logIgnored('extension_driver_session', e);
}
return version;
} finally {
try {
await bridge.shutdown();
} catch (_) {}
} catch (e) {
logIgnored('extension_driver_session', e);
}
}
}

Expand Down
9 changes: 7 additions & 2 deletions lib/core/extensions/harness/extension_harness.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:querya_desktop/core/extensions/harness/extension_protocol_profil
import 'package:querya_desktop/core/extensions/rpc/json_rpc_stdio_client.dart';
import 'package:querya_desktop/core/extensions/sandbox/sandbox_launch_command.dart';
import 'package:querya_desktop/core/extensions/sandbox/sandbox_scratch_directory.dart';
import 'package:querya_desktop/core/util/log_ignored.dart';

/// How to start the plugin process.
final class HarnessLaunchRequest {
Expand Down Expand Up @@ -133,7 +134,9 @@ final class _OsPluginProcess implements HarnessPluginProcess {
_process.kill(ProcessSignal.sigkill);
try {
await _process.exitCode.timeout(const Duration(seconds: 2));
} catch (_) {}
} catch (e) {
logIgnored('extension_harness', e);
}
}

@override
Expand Down Expand Up @@ -537,6 +540,8 @@ Future<int?> _rssKb(int pid) async {
final r = await Process.run('ps', ['-o', 'rss=', '-p', '$pid']);
return r.exitCode == 0 ? int.tryParse('${r.stdout}'.trim()) : null;
}
} catch (_) {}
} catch (e) {
logIgnored('extension_harness', e);
}
return null;
}
9 changes: 7 additions & 2 deletions lib/core/extensions/local_extension_installer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'package:querya_desktop/core/market/marketplace_repository.dart';
import 'package:querya_desktop/core/security/archive_path_guard.dart';
import 'package:querya_desktop/core/security/safe_zip_extractor.dart';
import 'package:querya_desktop/core/updater/sha256_checksums.dart';
import 'package:querya_desktop/core/util/log_ignored.dart';

/// Installs an extension package from a local `.zip` / `.qext` archive (issue #316).
///
Expand Down Expand Up @@ -206,7 +207,9 @@ class LocalExtensionInstaller {
// The new version is in place; a leftover backup is only clutter.
try {
await backup.delete(recursive: true);
} catch (_) {}
} catch (e) {
logIgnored('local_extension_installer', e);
}
}

await _reloadRegistry();
Expand All @@ -218,7 +221,9 @@ class LocalExtensionInstaller {
if (!swapped && await staging.exists()) {
await staging.delete(recursive: true);
}
} catch (_) {}
} catch (e) {
logIgnored('local_extension_installer', e);
}
if (e is MarketplaceException) rethrow;
throw MarketplaceException('Failed to install extension: $e');
}
Expand Down
9 changes: 7 additions & 2 deletions lib/core/extensions/sandbox/sandbox_process_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:querya_desktop/core/extensions/sandbox/sandbox_launch_command.da
import 'package:querya_desktop/core/extensions/sandbox/sandbox_os_isolation.dart';
import 'package:querya_desktop/core/extensions/sandbox/sandbox_scratch_directory.dart';
import 'package:querya_desktop/core/extensions/sandbox/sandbox_secret_guard.dart';
import 'package:querya_desktop/core/util/log_ignored.dart';

/// Live handle for a sandboxed OS process (Block E Level 2).
class SandboxProcessHandle {
Expand Down Expand Up @@ -57,8 +58,12 @@ class SandboxProcessHandle {
process.kill(ProcessSignal.sigkill);
try {
await process.exitCode.timeout(const Duration(seconds: 1));
} catch (_) {}
} catch (_) {}
} catch (e) {
logIgnored('sandbox_process_runner', e);
}
} catch (e) {
logIgnored('sandbox_process_runner', e);
}
} catch (e) {
debugPrint('SandboxProcessHandle.dispose($pluginId) kill: $e');
}
Expand Down
5 changes: 4 additions & 1 deletion lib/core/mcp/mcp_access_store.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:convert';

import 'package:querya_desktop/core/storage/local_db.dart';
import 'package:querya_desktop/core/util/log_ignored.dart';

/// Which connections MCP clients may read. Opt-in per connection: a
/// connection that was never enabled is invisible to every MCP tool.
Expand Down Expand Up @@ -29,7 +30,9 @@ class McpAccessStore implements McpAccessSettings {
try {
final decoded = jsonDecode(raw);
if (decoded is List) return {for (final v in decoded) if (v is int) v};
} catch (_) {}
} catch (e) {
logIgnored('mcp_access_store', e);
}
return {};
}

Expand Down
5 changes: 4 additions & 1 deletion lib/core/mcp/mcp_mongo_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:querya_desktop/core/mcp/mcp_access_store.dart';
import 'package:querya_desktop/core/mcp/mcp_query_service.dart';
import 'package:querya_desktop/core/mcp/mcp_redaction.dart';
import 'package:querya_desktop/core/storage/local_db.dart';
import 'package:querya_desktop/core/util/log_ignored.dart';

/// Why [McpMongoGuard] refused a filter or sort: a stable rule id
/// for the audit log and the message the model reads.
Expand Down Expand Up @@ -287,7 +288,9 @@ class McpMongoService {
} finally {
try {
await session?.close();
} catch (_) {}
} catch (e) {
logIgnored('mcp_mongo_service', e);
}
}
}

Expand Down
5 changes: 4 additions & 1 deletion lib/core/mcp/mcp_server_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:querya_desktop/core/mcp/mcp_query_service.dart';
import 'package:querya_desktop/core/mcp/mcp_socket_host.dart';
import 'package:querya_desktop/core/mcp/querya_mcp_server.dart';
import 'package:querya_desktop/core/storage/local_db.dart';
import 'package:querya_desktop/core/util/log_ignored.dart';

/// Owns the in-app MCP server: starts it when enabled in settings, stops it
/// on shutdown, and reports status and tool calls to the UI.
Expand Down Expand Up @@ -163,7 +164,9 @@ class McpServerController {
try {
name = (await LocalDb.instance.getConnectionById(r.connectionId!))
?.name;
} catch (_) {}
} catch (e) {
logIgnored('mcp_server_controller', e);
}
}
final sql = r.sql;
await LocalDb.instance.recordMcpActivity(McpActivityEntry(
Expand Down
9 changes: 7 additions & 2 deletions lib/core/security/connection_environment.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:querya_desktop/core/util/log_ignored.dart';
import 'dart:convert';

/// Which kind of server a connection points at. Drives the color coding in the
Expand Down Expand Up @@ -40,7 +41,9 @@ enum ConnectionEnvironment {
try {
final decoded = jsonDecode(driverOptions);
if (decoded is Map) return fromStorageValue(decoded[optionsKey]);
} catch (_) {}
} catch (e) {
logIgnored('connection_environment', e);
}
return null;
}

Expand All @@ -56,7 +59,9 @@ enum ConnectionEnvironment {
try {
final decoded = jsonDecode(driverOptions);
if (decoded is Map) options = Map<String, dynamic>.from(decoded);
} catch (_) {}
} catch (e) {
logIgnored('connection_environment', e);
}
}
if (environment == null) {
options.remove(optionsKey);
Expand Down
Loading
Loading