Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removed error-maker dependency

  • Loading branch information...
commit ec238b7a23f3ab693762afd7bb2df588cca88fdf 1 parent 3c12b41
@gagle authored
Showing with 19 additions and 20 deletions.
  1. +5 −3 lib/error.js
  2. +4 −4 lib/parse.js
  3. +10 −10 lib/read.js
  4. +0 −3  package.json
View
8 lib/error.js
@@ -1,5 +1,7 @@
"use strict";
-var make = require ("error-maker");
-
-module.exports = make ("PropertiesError");
+module.exports = function (msg){
+ var error = new Error (msg);
+ error.name = "PropertiesError";
+ return error;
+};
View
8 lib/parse.js
@@ -254,8 +254,8 @@ module.exports = function (data, options, handlers, control){
isSectionLine = false;
if (!ignoreLine){
//The section doesn't end with ], it's a key
- control.error = new PropertiesError ("The section line \"" +
- section + "\" must end with \"]\"");
+ control.error = PropertiesError ("The section line \"" + section +
+ "\" must end with \"]\"");
return;
}
ignoreLine = false;
@@ -273,8 +273,8 @@ module.exports = function (data, options, handlers, control){
if (isSectionLine && !ignoreLine){
//The section doesn't end with ], it's a key
- control.error = new PropertiesError ("The section line \"" + section +
- "\" must end with \"]\"");
+ control.error = PropertiesError ("The section line \"" + section + "\" " +
+ "must end with \"]\"");
return;
}
line ();
View
20 lib/read.js
@@ -50,7 +50,7 @@ var expand = function (o, str, options, cb){
}else if (c === "}"){
holder = section !== null ? o[section] : o;
if (!holder){
- return cb (new PropertiesError ("The section \"" + section +
+ return cb (PropertiesError ("The section \"" + section +
"\" does not exist"));
}
@@ -64,7 +64,7 @@ var expand = function (o, str, options, cb){
}
if (v === undefined){
- return cb (new PropertiesError ("The property \"" + key +
+ return cb (PropertiesError ("The property \"" + key +
"\" does not exist"));
}
}
@@ -81,7 +81,7 @@ var expand = function (o, str, options, cb){
}
if (stack.length !== 0){
- return cb (new PropertiesError ("Malformed variable: " + str));
+ return cb (PropertiesError ("Malformed variable: " + str));
}
cb (null, key);
@@ -147,7 +147,7 @@ var build = function (data, options, dirname, cb){
var include = function (value){
if (currentSection !== null){
- return abort (new PropertiesError ("Cannot include files from inside " +
+ return abort (PropertiesError ("Cannot include files from inside " +
"a section: " + currentSection));
}
@@ -388,8 +388,8 @@ module.exports = function (data, options, cb){
comments.forEach (function (comment){
code = comment.charCodeAt (0);
if (comment.length > 1 || code < 33 || code > 126){
- throw new PropertiesError ("The comment token must be a single " +
- "printable ASCII character");
+ throw PropertiesError ("The comment token must be a single printable " +
+ "ASCII character");
}
c[comment] = true;
});
@@ -401,16 +401,16 @@ module.exports = function (data, options, cb){
separators.forEach (function (separator){
code = separator.charCodeAt (0);
if (separator.length > 1 || code < 33 || code > 126){
- throw new PropertiesError ("The separator token must be a single " +
- "printable ASCII character");
+ throw PropertiesError ("The separator token must be a single printable " +
+ "ASCII character");
}
s[separator] = true;
});
options._separators = s;
if (options.path){
- if (!cb) throw new PropertiesError ("A callback must be passed if the " +
- "data is a path");
+ if (!cb) throw PropertiesError ("A callback must be passed if the data " +
+ "is a path");
if (options.include){
read (data, options, cb);
}else{
View
3  package.json
@@ -8,9 +8,6 @@
"engines": {
"node": ">=0.10"
},
- "dependencies": {
- "error-maker": "*"
- },
"devDependencies": {
"ini": "1.1.x",
"speedy": "*",
Please sign in to comment.
Something went wrong with that request. Please try again.