JsonFiles has errors
This commit is contained in:
+4
-4
@@ -39,11 +39,12 @@ program
|
|||||||
*/
|
*/
|
||||||
var error = function(msg){
|
var error = function(msg){
|
||||||
|
|
||||||
|
|
||||||
if(!program.onlyErrors)
|
if(!program.onlyErrors)
|
||||||
log.error(msg);
|
log.error(msg);
|
||||||
|
|
||||||
if(Array.isArray(msg)) {
|
if(Array.isArray(msg)) {
|
||||||
error.summary.concat(msg);
|
error.summary = error.summary.concat(msg);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
error.summary.push(msg);
|
error.summary.push(msg);
|
||||||
@@ -80,7 +81,7 @@ var ok = function(msg){
|
|||||||
*/
|
*/
|
||||||
var overrideFile = new OverrideFile();
|
var overrideFile = new OverrideFile();
|
||||||
|
|
||||||
if(overrideFile.errors().length) {
|
if(overrideFile.hasErrors()) {
|
||||||
// json format errors
|
// json format errors
|
||||||
error(overrideFile.errors());
|
error(overrideFile.errors());
|
||||||
|
|
||||||
@@ -138,7 +139,7 @@ forOwn(endpoints, function(Endpoint, endpointName){
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var overrideFile = new JsonFile(fileinfo.path);
|
var overrideFile = new JsonFile(fileinfo.path);
|
||||||
if(overrideFile.errors().length)
|
if(overrideFile.hasErrors())
|
||||||
return error( util.format('%s is not valid json file \n - %s', gray(fileinfo.path), overrideFile.errors().join('\n -')) );
|
return error( util.format('%s is not valid json file \n - %s', gray(fileinfo.path), overrideFile.errors().join('\n -')) );
|
||||||
|
|
||||||
ok( fileinfo.canonicalPackageName + '@' + fileinfo.packageVersion );
|
ok( fileinfo.canonicalPackageName + '@' + fileinfo.packageVersion );
|
||||||
@@ -150,7 +151,6 @@ forOwn(endpoints, function(Endpoint, endpointName){
|
|||||||
//
|
//
|
||||||
// SUMMARY LOG
|
// SUMMARY LOG
|
||||||
//
|
//
|
||||||
|
|
||||||
if(error.summary.length) {
|
if(error.summary.length) {
|
||||||
log.n()
|
log.n()
|
||||||
('Error summary ................')
|
('Error summary ................')
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ JsonFile.prototype.errors = function(){
|
|||||||
return this._errors;
|
return this._errors;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
JsonFile.prototype.hasErrors = function(){
|
||||||
|
|
||||||
|
return this._errors.length > 0;
|
||||||
|
};
|
||||||
|
|
||||||
JsonFile.prototype.forEach = function(fn){
|
JsonFile.prototype.forEach = function(fn){
|
||||||
|
|
||||||
forOwn(this._json, fn, this);
|
forOwn(this._json, fn, this);
|
||||||
|
|||||||
Reference in New Issue
Block a user