Skip to content
Permalink
Browse files
Do not wrap errors from fetch & remove dead code
The errors from fetch were strongly emphasized (all red) for no obvious
reason. Moreover, everything after the first error event emission never
ran since the error event seems to cause an error to be thrown.
  • Loading branch information
raphinesse committed Jul 5, 2018
1 parent c063c87 commit 227ab6632af209d52a6f80fbec12bbf4b9348a21
Showing 1 changed file with 2 additions and 9 deletions.
@@ -137,16 +137,9 @@ function cordovaCreate (dest, opts = {}) {
if (opts.template && isRemoteUri(opts.url)) {
var target = opts.url;
events.emit('verbose', 'Using cordova-fetch for ' + target);
return fetch(target, getSelfDestructingTempDir(), {})
.catch(function (err) {
events.emit('error', '\x1B[1m \x1B[31m Error from Cordova Fetch: ' + err.message);
events.emit('error', 'The template you are trying to use is invalid.' +
' Make sure you follow the template guide found here https://cordova.apache.org/docs/en/latest/guide/cli/template.html.' +
' Templates now require a package.json.');
throw err;
});
// If assets are not online, resolve as a relative path on local computer
return fetch(target, getSelfDestructingTempDir(), {});
} else {
// If assets are not online, resolve as a relative path on local computer
return path.resolve(opts.url);
}
})

0 comments on commit 227ab66

Please sign in to comment.