use non-modified values in error messages
This commit is contained in:
parent
c965ffe7fd
commit
d266fb9509
11
lib/index.js
11
lib/index.js
@ -11,9 +11,8 @@ import path from 'path';
|
||||
import semver from 'semver';
|
||||
import { version } from '../package.json';
|
||||
|
||||
export async function need ({
|
||||
nodeRange, platform, arch, forceDownload, forceBuild
|
||||
} = {}) {
|
||||
export async function need (opts = {}) {
|
||||
let { nodeRange, platform, arch, forceDownload, forceBuild } = opts;
|
||||
if (!nodeRange) throw wasReported('nodeRange not specified');
|
||||
if (!platform) throw wasReported('platform not specified');
|
||||
if (!arch) throw wasReported('arch not specified');
|
||||
@ -32,7 +31,7 @@ export async function need ({
|
||||
nodeRange === 'latest')
|
||||
.sort((nv1, nv2) => semver.gt(nv1, nv2));
|
||||
if (!nodeVersions.length) {
|
||||
throw wasReported(`No available node version satisfies '${nodeRange}'`);
|
||||
throw wasReported(`No available node version satisfies '${opts.nodeRange}'`);
|
||||
}
|
||||
const nodeVersion = nodeVersions.pop();
|
||||
const downloaded = localPlace({ from: 'downloaded', arch, nodeVersion, platform, version });
|
||||
@ -57,10 +56,10 @@ export async function need ({
|
||||
if (downloadFailed) log.info('Not found in GitHub releases');
|
||||
log.info('Building base binary from source:', path.basename(built));
|
||||
if (hostPlatform !== platform) {
|
||||
throw wasReported(`Not able to build for '${platform}' here, only for '${hostPlatform}'`);
|
||||
throw wasReported(`Not able to build for '${opts.platform}' here, only for '${hostPlatform}'`);
|
||||
}
|
||||
if (knownArchs.indexOf(arch) < 0) {
|
||||
throw wasReported(`Unknown arch '${arch}'. Specify ${knownArchs.join(', ')}`);
|
||||
throw wasReported(`Unknown arch '${opts.arch}'. Specify ${knownArchs.join(', ')}`);
|
||||
}
|
||||
|
||||
await build(nodeVersion, arch, built);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user