Skip to content

Commit a5edfe2

Browse files
committed
Fix typo + rethrow unhelpful error
1 parent e910fc4 commit a5edfe2

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

PowerSync/PowerSync.Common/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
- Add support for .NET 9.0. Supported targets now also include `net9.0`, `net9.0-android`, `net9.0-ios`, and `net9.0-maccatalyst`.
77
- Update the PowerSync SQLite core extension to 0.4.13.
88
- Add support for offline-first file attachments via `AttachmentQueue`. See `Attachments/README.md`.
9-
- Add support for loading custom SQLite extensions via `MDSqliteOptions.Extensions`.
9+
- Add support for loading custom SQLite extensions via `MDSQLiteOptions.Extensions`.
1010

1111
## 0.1.1
1212

PowerSync/PowerSync.Common/MDSQLite/MDSQLiteAdapter.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,22 @@ protected async Task<MDSQLiteConnection> OpenConnection(string dbFilename)
129129
LoadExtensions(db);
130130

131131
var connection = new MDSQLiteConnection(new MDSQLiteConnectionOptions(db));
132-
await connection.Execute("SELECT powersync_init()");
132+
try
133+
{
134+
await connection.Execute("SELECT powersync_init()");
135+
}
136+
catch (SqliteException ex)
137+
{
138+
// SQLite will throw a very unhelpful "SQLite Error 1: 'The specified
139+
// module could not be found.'" error if uncaught.
140+
throw new SqliteException(
141+
"Failed to initialize PowerSync: powersync_init() is not registered. " +
142+
"Ensure the PowerSync core SQLite extension is loaded. Either set " +
143+
"MDSQLiteOptions.LoadPowerSyncExtension to true (default), or supply " +
144+
"a PowerSync-compatible extension via MDSQLiteOptions.Extensions.",
145+
ex.SqliteErrorCode,
146+
ex.SqliteExtendedErrorCode);
147+
}
133148

134149
return connection;
135150
}

0 commit comments

Comments
 (0)