diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-02-11 18:18:33 +0100 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-02-11 18:18:33 +0100 |
commit | e7eed2abbe91fa44bd071819123bd9ea04d1702a (patch) | |
tree | db6290eec86c94cb31ab8d2eeb26fa7145c6c09e /lib/utils | |
parent | 98a13cf487e3b2823cfde38ab1d1b8f97f614517 (diff) | |
download | gitbook-e7eed2abbe91fa44bd071819123bd9ea04d1702a.zip gitbook-e7eed2abbe91fa44bd071819123bd9ea04d1702a.tar.gz gitbook-e7eed2abbe91fa44bd071819123bd9ea04d1702a.tar.bz2 |
Complete conrefs in parsing
Diffstat (limited to 'lib/utils')
-rw-r--r-- | lib/utils/error.js | 12 | ||||
-rw-r--r-- | lib/utils/git.js | 5 |
2 files changed, 11 insertions, 6 deletions
diff --git a/lib/utils/error.js b/lib/utils/error.js index 4ccf83d..5ee6a0e 100644 --- a/lib/utils/error.js +++ b/lib/utils/error.js @@ -13,30 +13,30 @@ function enforce(err) { // Random error wrappers during parsing/generation var ParsingError = WrappedError({ message: 'Parsing Error: {origMessage}', - type: 'server.parsing-failed' + type: 'parse' }); var GenerationError = WrappedError({ message: 'Generation Error: {origMessage}', - type: 'server.parsing-failed' + type: 'generate' }); // Error when output generator does not exists var GeneratorNotFoundError = TypedError({ - type: 'server.404', + type: 'generator.not-found', message: 'Generator "{generator}" does not exists', generator: null }); // A file does not exists var FileNotFoundError = TypedError({ - type: 'server.404', + type: 'file.not-found', message: 'No "{filename}" file (or is ignored)', filename: null }); // A file is outside the scope var FileOutOfScopeError = TypedError({ - type: 'server.404', + type: 'file.out-of-scope', message: '"{filename}" not in "{root}"', filename: null, root: null, @@ -46,7 +46,7 @@ var FileOutOfScopeError = TypedError({ // Error for nunjucks templates var TemplateError = WrappedError({ message: 'Error compiling template "{filename}": {origMessage}', - type: 'client.template-failed', + type: 'template', filename: null }); diff --git a/lib/utils/git.js b/lib/utils/git.js index 9fca73f..baf0fab 100644 --- a/lib/utils/git.js +++ b/lib/utils/git.js @@ -51,6 +51,11 @@ Git.prototype.clone = function(host, ref) { // Get file from a git repo Git.prototype.resolve = function(giturl) { + // Path to a file in a git repo? + if (!Git.isUrl(giturl)) { + if (this.resolveRoot(giturl)) return Promise(giturl); + return Promise(null); + } if (_.isString(giturl)) giturl = Git.parseUrl(giturl); if (!giturl) return Promise(null); |