Skip to content

Commit bbac793

Browse files
committed
chore: Improve error message for incompatible powersync core version
1 parent fc6bd31 commit bbac793

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

packages/powersync/bin/setup_web.dart

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ void main(List<String> arguments) async {
7373
if (matchTag != null) {
7474
sqlite3Version = matchTag;
7575
} else {
76-
//TODO: Use a better message to inform the user about the incompatibility
7776
throw Exception(
78-
"No compatible powersync core version found for sqlite3 version $sqlite3Version, Please update your sqlite3 version");
77+
"""No compatible powersync core version found for sqlite3 version $sqlite3Version
78+
79+
Run `flutter pub upgrade powersync` to get the latest version of the powersync package.""");
7980
}
8081

8182
final sqliteUrl =
@@ -90,12 +91,7 @@ void main(List<String> arguments) async {
9091

9192
bool coreVersionIsInRange(String tag) {
9293
//Sets the range of powersync core version that is compatible with the sqlite3 version
93-
VersionRange range = VersionRange(
94-
min: Version(0, 1, 0),
95-
max: Version(0, 1, 9),
96-
includeMin: true,
97-
includeMax: true,
98-
);
94+
VersionConstraint constraint = VersionConstraint.parse('>=0.1.0 <=0.1.9');
9995
if (!tag.contains("-powersync")) return false;
10096
List<String> parts = tag.split('-');
10197
String powersyncPart = parts[1];
@@ -104,7 +100,7 @@ bool coreVersionIsInRange(String tag) {
104100
String extractedVersion =
105101
versionParts.sublist(versionParts.length - 3).join('.');
106102
final coreVersion = Version.parse(extractedVersion);
107-
if (range.allows(coreVersion)) {
103+
if (constraint.allows(coreVersion)) {
108104
return true;
109105
}
110106
return false;

0 commit comments

Comments
 (0)