diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-25 15:09:57 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-02-25 15:09:57 +0100 |
commit | 393aed62706745e2abde300844143b5d2a0c9041 (patch) | |
tree | 33da1c4e18796ccfe1ad3638228a1fde953e668c /lib/utils/error.js | |
parent | b240d6a8fcbab80ea35da8cee58576f674ea1821 (diff) | |
download | gitbook-393aed62706745e2abde300844143b5d2a0c9041.zip gitbook-393aed62706745e2abde300844143b5d2a0c9041.tar.gz gitbook-393aed62706745e2abde300844143b5d2a0c9041.tar.bz2 |
Improve error msg for ebook generation
Diffstat (limited to 'lib/utils/error.js')
-rw-r--r-- | lib/utils/error.js | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/utils/error.js b/lib/utils/error.js index 52281bf..27fa59d 100644 --- a/lib/utils/error.js +++ b/lib/utils/error.js @@ -41,6 +41,15 @@ var FileOutOfScopeError = TypedError({ code: 'EACCESS' }); +// A file is outside the scope +var RequireInstallError = TypedError({ + type: 'install.required', + message: '"{cmd}" is not installed.\n{install}', + cmd: null, + code: 'ENOENT', + install: '' +}); + // Error for nunjucks templates var TemplateError = WrappedError({ message: 'Error compiling template "{filename}": {origMessage}', @@ -55,12 +64,19 @@ var PluginError = WrappedError({ plugin: null }); -// Error for nunjucks templates +// Error with the book's configuration var ConfigurationError = WrappedError({ message: 'Error with book\'s configuration: {origMessage}', type: 'configuration' }); +// Error during ebook generation +var EbookError = WrappedError({ + message: 'Error during ebook generation: {origMessage}\n{stdout}', + type: 'ebook', + stdout: '' +}); + // Deprecate methods/fields function deprecateMethod(fn, msg) { return deprecated.method(msg, log.warn.ln, fn); @@ -74,6 +90,7 @@ module.exports = { ParsingError: ParsingError, OutputError: OutputError, + RequireInstallError: RequireInstallError, FileNotFoundError: FileNotFoundError, FileOutOfScopeError: FileOutOfScopeError, @@ -81,6 +98,7 @@ module.exports = { TemplateError: TemplateError, PluginError: PluginError, ConfigurationError: ConfigurationError, + EbookError: EbookError, deprecateMethod: deprecateMethod, deprecateField: deprecateField |