summaryrefslogtreecommitdiffstats
path: root/lib/utils/error.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils/error.js')
-rw-r--r--lib/utils/error.js30
1 files changed, 12 insertions, 18 deletions
diff --git a/lib/utils/error.js b/lib/utils/error.js
index 27fa59d..7686779 100644
--- a/lib/utils/error.js
+++ b/lib/utils/error.js
@@ -1,15 +1,12 @@
-var _ = require('lodash');
+var is = require('is');
+
var TypedError = require('error/typed');
var WrappedError = require('error/wrapped');
-var deprecated = require('deprecated');
-
-var Logger = require('./logger');
-var log = new Logger();
// Enforce as an Error object, and cleanup message
function enforce(err) {
- if (_.isString(err)) err = new Error(err);
+ if (is.string(err)) err = new Error(err);
err.message = err.message.replace(/^Error: /, '');
return err;
@@ -32,6 +29,13 @@ var FileNotFoundError = TypedError({
filename: null
});
+// A file cannot be parsed
+var FileNotParsableError = TypedError({
+ type: 'file.not-parsable',
+ message: '"{filename}" file cannot be parsed',
+ filename: null
+});
+
// A file is outside the scope
var FileOutOfScopeError = TypedError({
type: 'file.out-of-scope',
@@ -77,14 +81,6 @@ var EbookError = WrappedError({
stdout: ''
});
-// Deprecate methods/fields
-function deprecateMethod(fn, msg) {
- return deprecated.method(msg, log.warn.ln, fn);
-}
-function deprecateField(obj, prop, value, msg) {
- return deprecated.field(msg, log.warn.ln, obj, prop, value);
-}
-
module.exports = {
enforce: enforce,
@@ -92,14 +88,12 @@ module.exports = {
OutputError: OutputError,
RequireInstallError: RequireInstallError,
+ FileNotParsableError: FileNotParsableError,
FileNotFoundError: FileNotFoundError,
FileOutOfScopeError: FileOutOfScopeError,
TemplateError: TemplateError,
PluginError: PluginError,
ConfigurationError: ConfigurationError,
- EbookError: EbookError,
-
- deprecateMethod: deprecateMethod,
- deprecateField: deprecateField
+ EbookError: EbookError
};