Skip to content

Commit d1d8a24

Browse files
committed
src/d.ts: fix some error messages
Add an error message for dmd being used on non-x86_64 and correct some other messages. Signed-off-by: Andrei Horodniceanu <[email protected]>
1 parent 7eb500c commit d1d8a24

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

dist/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/d.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ export class DMD extends Compiler {
174174
All of the formats /except/ dmd-master come with a signature file.
175175
*/
176176
static async initialize(versionString: string, token: string): Promise<DMD> {
177+
if (process.arch != 'x64')
178+
throw new Error(`dmd can only be used on x86_64, not on '${process.arch}'`)
177179
if (versionString == 'dmd-master') {
178180
return await DMD.initializeFromMaster(token)
179181
}
@@ -520,7 +522,7 @@ export class LDC extends Compiler {
520522
case "x64": arch = "x86_64"; break;
521523
case "arm": arch = "armhf"; break; // supported on old LDC releases
522524
case "arm64": arch = "aarch64"; break;
523-
default: throw new Error(`Unknown architecture ${arch} for ldc on linux`)
525+
default: throw new Error(`Unknown architecture ${process.arch} for ldc on linux`)
524526
}
525527
return `linux-${arch}.tar.xz`
526528
case "darwin":
@@ -530,7 +532,7 @@ export class LDC extends Compiler {
530532
case "x64": arch = "x86_64"; break;
531533
case "arm":
532534
case "arm64": arch = "arm64"; break;
533-
default: throw new Error(`Unknown architecture ${arch} for ldc on osx`)
535+
default: throw new Error(`Unknown architecture ${process.arch} for ldc on osx`)
534536
}
535537
arch = legacyOsx ? arch : 'universal'
536538
return `osx-${arch}.tar.xz`
@@ -755,7 +757,7 @@ export class GDC implements ITool {
755757

756758
let match = versionString.match(/^gdc(-\d+)?$/)
757759
if (match === null)
758-
throw new Error(`Unrecognized gdc format '${versionString}`)
760+
throw new Error(`Unrecognized gdc format '${versionString}'`)
759761

760762
return new GDC(versionString)
761763
}

0 commit comments

Comments
 (0)