(pathProvider: PathProvider, version: string)
| 24 | } |
| 25 | |
| 26 | export function assertDesktopDataDirCompatible(pathProvider: PathProvider, version: string): RuntimeIdentity { |
| 27 | const runtime = createDesktopRuntimeIdentity(version) |
| 28 | |
| 29 | try { |
| 30 | assertDataDirCompatible(pathProvider, runtime) |
| 31 | } catch (error) { |
| 32 | if ( |
| 33 | error instanceof DataDirCompatibilityError && |
| 34 | error.code === 'DATA_DIR_REQUIRES_NEWER_RUNTIME' && |
| 35 | error.minRuntimeVersion |
| 36 | ) { |
| 37 | throw new Error(formatDesktopDataDirCompatibilityError(error, runtime), { cause: error }) |
| 38 | } |
| 39 | |
| 40 | throw error |
| 41 | } |
| 42 | |
| 43 | return runtime |
| 44 | } |
| 45 | |
| 46 | function normalizeVersion(version: string | null | undefined): string { |
| 47 | return typeof version === 'string' ? version.trim() : '' |
no test coverage detected