Skip to content

Commit 6187af4

Browse files
authored
fix: use correct error message when user-installed plugin is outdated (#518)
1 parent e06ded6 commit 6187af4

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

TablePro/Core/Plugins/PluginError.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ enum PluginError: LocalizedError {
1010
case signatureInvalid(detail: String)
1111
case checksumMismatch
1212
case incompatibleVersion(required: Int, current: Int)
13+
case pluginOutdated(pluginVersion: Int, requiredVersion: Int)
1314
case cannotUninstallBuiltIn
1415
case notFound
1516
case noCompatibleBinary
@@ -31,6 +32,8 @@ enum PluginError: LocalizedError {
3132
return String(localized: "Plugin checksum does not match expected value")
3233
case .incompatibleVersion(let required, let current):
3334
return String(localized: "Plugin requires PluginKit version \(required), but app provides version \(current)")
35+
case .pluginOutdated(let pluginVersion, let requiredVersion):
36+
return String(localized: "Plugin was built with PluginKit version \(pluginVersion), but version \(requiredVersion) is required. Please update the plugin.")
3437
case .cannotUninstallBuiltIn:
3538
return String(localized: "Built-in plugins cannot be uninstalled")
3639
case .notFound:

TablePro/Core/Plugins/PluginManager.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ final class PluginManager {
182182

183183
if entry.source == .userInstalled {
184184
if pluginKitVersion < currentPluginKitVersion {
185-
logger.error("User plugin \(entry.url.lastPathComponent) has outdated PluginKit v\(pluginKitVersion)")
185+
logger.error("User plugin \(entry.url.lastPathComponent) was built with PluginKit v\(pluginKitVersion), but v\(currentPluginKitVersion) is required")
186186
continue
187187
}
188188
}
@@ -383,9 +383,9 @@ final class PluginManager {
383383
// have stale witness tables — accessing protocol properties crashes with
384384
// EXC_BAD_ACCESS. Reject them before loading the bundle.
385385
if pluginKitVersion < Self.currentPluginKitVersion {
386-
throw PluginError.incompatibleVersion(
387-
required: Self.currentPluginKitVersion,
388-
current: pluginKitVersion
386+
throw PluginError.pluginOutdated(
387+
pluginVersion: pluginKitVersion,
388+
requiredVersion: Self.currentPluginKitVersion
389389
)
390390
}
391391
try verifyCodeSignature(bundle: bundle)
@@ -419,9 +419,9 @@ final class PluginManager {
419419

420420
if source == .userInstalled {
421421
if pluginKitVersion < Self.currentPluginKitVersion {
422-
throw PluginError.incompatibleVersion(
423-
required: Self.currentPluginKitVersion,
424-
current: pluginKitVersion
422+
throw PluginError.pluginOutdated(
423+
pluginVersion: pluginKitVersion,
424+
requiredVersion: Self.currentPluginKitVersion
425425
)
426426
}
427427
try verifyCodeSignature(bundle: bundle)

TablePro/Resources/Localizable.xcstrings

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9393,9 +9393,6 @@
93939393
}
93949394
}
93959395
}
9396-
},
9397-
"DataGridView placeholder for: %@" : {
9398-
93999396
},
94009397
"Date format:" : {
94019398
"localizations" : {
@@ -14166,9 +14163,6 @@
1416614163
}
1416714164
}
1416814165
}
14169-
},
14170-
"Fix with AI" : {
14171-
1417214166
},
1417314167
"Focus Border" : {
1417414168
"localizations" : {
@@ -25645,6 +25639,9 @@
2564525639
}
2564625640
}
2564725641
}
25642+
},
25643+
"Results" : {
25644+
2564825645
},
2564925646
"Retention" : {
2565025647
"localizations" : {
@@ -26102,9 +26099,6 @@
2610226099
}
2610326100
}
2610426101
}
26105-
},
26106-
"Run a query to see results" : {
26107-
2610826102
},
2610926103
"Run in New Tab" : {
2611026104
"localizations" : {
@@ -32302,6 +32296,9 @@
3230232296
},
3230332297
"Toggle Results" : {
3230432298

32299+
},
32300+
"Toggle Results (⌘⌥R)" : {
32301+
3230532302
},
3230632303
"Toggle Table Browser" : {
3230732304
"localizations" : {

0 commit comments

Comments
 (0)