Skip to content

Commit a10d0b9

Browse files
committed
Show error message if GHC version is not supported
1 parent 123dd09 commit a10d0b9

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

src/hlsBinaries.ts

+7-21
Original file line numberDiff line numberDiff line change
@@ -303,24 +303,6 @@ async function getLatestSuitableHLS(
303303
): Promise<string> {
304304
const storagePath: string = await getStoragePath(context);
305305

306-
// get latest hls version
307-
const hlsVersions = await callGHCup(
308-
context,
309-
logger,
310-
['list', '-t', 'hls', '-c', 'available', '-r'],
311-
undefined,
312-
false,
313-
);
314-
// Output looks like:
315-
// ```
316-
// hls 1.5.1
317-
// hls 1.6.0.0
318-
// hls 1.6.1.0 latest,recommended
319-
// hls 1.6.1.1 stray
320-
// ```
321-
// and we want the `1.6.1.1`
322-
const latestHlsVersion = hlsVersions.split(/\r?\n/).pop()!.split(' ')[1];
323-
324306
// get project GHC version, but fallback to system ghc if necessary.
325307
const projectGhc =
326308
wrapper === undefined
@@ -330,9 +312,13 @@ async function getLatestSuitableHLS(
330312
// get installable HLS that supports the project GHC version (this might not be the most recent)
331313
const latestMetadataHls =
332314
projectGhc !== null ? await getLatestHLSforGHC(context, storagePath, projectGhc, logger) : null;
333-
const installableHls = latestMetadataHls !== null ? latestMetadataHls : latestHlsVersion;
334-
335-
return installableHls;
315+
if (latestMetadataHls === null) {
316+
const noMatchingHLS = `No HLS version was found for supporting GHC ${projectGhc}.`;
317+
window.showErrorMessage(noMatchingHLS);
318+
throw new Error(noMatchingHLS);
319+
} else {
320+
return latestMetadataHls;
321+
}
336322
}
337323

338324
/**

0 commit comments

Comments
 (0)