Skip to content

Commit 82ae4c1

Browse files
committed
Show error message if GHC version is not supported
1 parent e9d3efa commit 82ae4c1

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
@@ -301,24 +301,6 @@ async function getLatestSuitableHLS(
301301
): Promise<string> {
302302
const storagePath: string = await getStoragePath(context);
303303

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

336322
/**

0 commit comments

Comments
 (0)