parseJson.js 297 B

12345678910111213141516
  1. //
  2. 'use strict';
  3. const parseJson = require('parse-json');
  4. module.exports = function parseJsonWrapper(
  5. json ,
  6. filepath
  7. ) {
  8. try {
  9. return parseJson(json);
  10. } catch (err) {
  11. err.message = `JSON Error in ${filepath}:\n${err.message}`;
  12. throw err;
  13. }
  14. };