From 741ef89fe18b449be45b46e084b4e50de597aaa2 Mon Sep 17 00:00:00 2001 From: Todor Totev Date: Tue, 1 Dec 2015 17:26:44 +0200 Subject: [PATCH] Improve XML parser validation output --- lib/services/platform-service.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/services/platform-service.ts b/lib/services/platform-service.ts index 5cc1698b69..0a9fcdbc20 100644 --- a/lib/services/platform-service.ts +++ b/lib/services/platform-service.ts @@ -8,6 +8,7 @@ import * as helpers from "../common/helpers"; import * as semver from "semver"; import * as minimatch from "minimatch"; import Future = require("fibers/future"); +import {EOL} from "os"; export class PlatformService implements IPlatformService { private static TNS_MODULES_FOLDER_NAME = "tns_modules"; @@ -179,7 +180,11 @@ export class PlatformService implements IPlatformService { .forEach(file => { let fileContents = this.$fs.readText(file).wait(); let hasErrors = false; - let domErrorHandler = (level:any, msg:string) => hasErrors = true; + let errorOutput = ""; + let domErrorHandler = (level:any, msg:string) => { + errorOutput += level + EOL + msg + EOL; + hasErrors = true; + }; let parser = new DomParser({ locator:{}, errorHandler: domErrorHandler @@ -187,7 +192,8 @@ export class PlatformService implements IPlatformService { parser.parseFromString(fileContents, "text/xml"); xmlHasErrors = xmlHasErrors || hasErrors; if (xmlHasErrors) { - this.$logger.out("Error: ".red.bold + file + " has syntax errors.".red.bold); + this.$logger.warn(`${file} has syntax errors.`); + this.$logger.out(errorOutput); } }); return !xmlHasErrors;