Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit c464143

Browse files
committed
Update errors to use options
1 parent ba2aa59 commit c464143

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

lib/binding.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@
33
*/
44

55
var errors = require('./errors'),
6-
Constants = require('./constants');
6+
Constants = require('./constants'),
7+
DefaultOptions = Constants.DefaultOptions;
78
/**
89
* Require binding
910
*/
1011
module.exports = function(ext) {
11-
if (!ext.hasBinary(ext.getBinaryPath(Constants.DefaultOptions))) {
12-
if (!ext.isSupportedEnvironment()) {
13-
throw new Error(errors.unsupportedEnvironment());
12+
if (!ext.hasBinary(ext.getBinaryPath(DefaultOptions))) {
13+
if (!ext.isSupportedEnvironment(process.platform, DefaultOptions.arch, DefaultOptions.modulesVersion)) {
14+
throw new Error(errors.unsupportedEnvironment(DefaultOptions));
1415
} else {
15-
throw new Error(errors.missingBinary());
16+
throw new Error(errors.missingBinary(DefaultOptions));
1617
}
1718
}
1819

19-
return require(ext.getBinaryPath(Constants.DefaultOptions));
20+
return require(ext.getBinaryPath(DefaultOptions));
2021
};

lib/errors.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
*/
44

55
var sass = require('./extensions'),
6-
Constants = require('./constants'),
76
pkg = require('../package.json');
87

9-
function humanEnvironment() {
10-
return sass.getHumanEnvironment(sass.getBinaryName(Constants.DefaultOptions));
8+
function humanEnvironment(options) {
9+
return sass.getHumanEnvironment(sass.getBinaryName(options));
1110
}
1211

1312
function foundBinaries() {
@@ -30,18 +29,18 @@ function missingBinaryFooter() {
3029
].join('\n');
3130
}
3231

33-
module.exports.unsupportedEnvironment = function() {
32+
module.exports.unsupportedEnvironment = function(options) {
3433
return [
35-
'Node Sass does not yet support your current environment: ' + humanEnvironment(),
34+
'Node Sass does not yet support your current environment: ' + humanEnvironment(options),
3635
'For more information on which environments are supported please see:',
3736
'https://github.com/sass/node-sass/releases/tag/v' + pkg.version
3837
].join('\n');
3938
};
4039

41-
module.exports.missingBinary = function() {
40+
module.exports.missingBinary = function(options) {
4241
return [
43-
'Missing binding ' + sass.getBinaryPath(),
44-
'Node Sass could not find a binding for your current environment: ' + humanEnvironment(),
42+
'Missing binding ' + sass.getBinaryPath(options),
43+
'Node Sass could not find a binding for your current environment: ' + humanEnvironment(options),
4544
'',
4645
foundBinaries(),
4746
'',

0 commit comments

Comments
 (0)