diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-12-22 10:18:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-22 10:18:38 +0100 |
commit | 194ebc3da9641ff96f083f9d8ab43c2d27944f9a (patch) | |
tree | c50988f32ccf18df93ae7ab40be78e9459642818 /lib/utils/error.js | |
parent | 64ccb6b00b4b63fa0e516d4e35351275b34f8c07 (diff) | |
parent | 16af264360e48e8a833e9efa9ab8d194574dbc70 (diff) | |
download | gitbook-194ebc3da9641ff96f083f9d8ab43c2d27944f9a.zip gitbook-194ebc3da9641ff96f083f9d8ab43c2d27944f9a.tar.gz gitbook-194ebc3da9641ff96f083f9d8ab43c2d27944f9a.tar.bz2 |
Merge pull request #1543 from GitbookIO/dream
React for rendering website with plugins
Diffstat (limited to 'lib/utils/error.js')
-rw-r--r-- | lib/utils/error.js | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/lib/utils/error.js b/lib/utils/error.js deleted file mode 100644 index 7686779..0000000 --- a/lib/utils/error.js +++ /dev/null @@ -1,99 +0,0 @@ -var is = require('is'); - -var TypedError = require('error/typed'); -var WrappedError = require('error/wrapped'); - - -// Enforce as an Error object, and cleanup message -function enforce(err) { - if (is.string(err)) err = new Error(err); - err.message = err.message.replace(/^Error: /, ''); - - return err; -} - -// Random error wrappers during parsing/generation -var ParsingError = WrappedError({ - message: 'Parsing Error: {origMessage}', - type: 'parse' -}); -var OutputError = WrappedError({ - message: 'Output Error: {origMessage}', - type: 'generate' -}); - -// A file does not exists -var FileNotFoundError = TypedError({ - type: 'file.not-found', - message: 'No "{filename}" file (or is ignored)', - 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', - message: '"{filename}" not in "{root}"', - filename: null, - root: null, - 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}', - type: 'template', - filename: null -}); - -// Error for nunjucks templates -var PluginError = WrappedError({ - message: 'Error with plugin "{plugin}": {origMessage}', - type: 'plugin', - plugin: null -}); - -// 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: '' -}); - -module.exports = { - enforce: enforce, - - ParsingError: ParsingError, - OutputError: OutputError, - RequireInstallError: RequireInstallError, - - FileNotParsableError: FileNotParsableError, - FileNotFoundError: FileNotFoundError, - FileOutOfScopeError: FileOutOfScopeError, - - TemplateError: TemplateError, - PluginError: PluginError, - ConfigurationError: ConfigurationError, - EbookError: EbookError -}; |