From 8283fffecdc62f09b54e2af81a462e285b7ca068 Mon Sep 17 00:00:00 2001
From: Anjan Kaur <anjankaur01.mkr@gmail.com>
Date: Tue, 1 May 2018 23:59:43 +0530
Subject: [PATCH] log info about schema for which ajv will throw exception

---
 cli.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/cli.js b/cli.js
index 07c1a5c..55193e0 100755
--- a/cli.js
+++ b/cli.js
@@ -88,7 +88,13 @@ if (target.isDirectory()) {
   readdirp({ root: schemaPath, fileFilter: `*.${schemaExtension}` })
     .on('data', entry => {
       files.push(entry.fullPath);
-      ajv.addSchema(require(entry.fullPath), entry.fullPath);
+      try {
+        ajv.addSchema(require(entry.fullPath), entry.fullPath);
+      }catch(e){
+        logger.error('Ajv processing error for schema at path %s',entry.fullPath);
+        logger.error(e);
+        process.exit(1);
+      }
     })
     .on('end', () => {
       Schema.setAjv(ajv);
-- 
GitLab