Comparing version 0.8.0 to 0.8.1
@@ -7,2 +7,8 @@ 'use strict'; | ||
const fmt = { | ||
error: {head: '\u001b[31;1m', tail: '\u001b[0m '}, | ||
warn: {head: '\u001b[33;1m', tail: '\u001b[0m '}, | ||
info: {head: '\u001b[32;1m', tail: '\u001b[0m '} | ||
}; | ||
module.exports = argv => new Promise(resolve => { | ||
@@ -16,3 +22,11 @@ if (argv.verbose) console.log('reading spec'); | ||
processContent: function (res, cb) { | ||
let ml = JSON5.parse(res.text); | ||
let ml; | ||
try { | ||
ml = JSON5.parse(res.text); | ||
} catch(err) { | ||
console.error( | ||
fmt.error.head + 'Error' + fmt.error.tail + err.message + ' in ' + res.location | ||
); | ||
return; | ||
} | ||
cb(undefined, ml); | ||
@@ -19,0 +33,0 @@ } |
@@ -16,3 +16,3 @@ 'use strict'; | ||
const hfmt = [ | ||
const headFormat = [ | ||
{head: '\u001b[4m', tail: '\u001b[0m '}, | ||
@@ -23,3 +23,3 @@ {head: '\u001b[4m', tail: '\u001b[0m '}, | ||
const bfmt = [ | ||
const bodyFormat = [ | ||
{head: '\u001b[33;1m', tail: '\u001b[0m '}, | ||
@@ -40,4 +40,4 @@ {head: '\u001b[34;1m', tail: '\u001b[0m '}, | ||
'DUH document does not match schema:', | ||
['data path', 'schema path', 'message'].reduce(formatter(hfmt, widths), ''), | ||
errora.map(row => row.reduce(formatter(bfmt, widths), '')).join('\n') | ||
['data path', 'schema path', 'message'].reduce(formatter(headFormat, widths), ''), | ||
errora.map(row => row.reduce(formatter(bodyFormat, widths), '')).join('\n') | ||
].join('\n'); | ||
@@ -44,0 +44,0 @@ }; |
{ | ||
"name": "duh-core", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"description": "DUH core", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
[![NPM version](https://img.shields.io/npm/v/duh-core.svg)](https://www.npmjs.org/package/duh-core) | ||
[![Travis build Status](https://travis-ci.org/sifive/duh-core.svg?branch=master)](https://travis-ci.org/sifive/duh-core) | ||
[![Actions Status](https://github.com/sifive/duh-core/workflows/Tests/badge.svg)](https://github.com/sifive/duh-core/actions) | ||
@@ -4,0 +4,0 @@ DUH core library |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18053
10
166