Skip to content

refactor(logging): aligned error messages with reporting criticality #1317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core/src/lib/buildFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ module.exports = function (patternlab, patternPartial, uikit) {
'config.paths.source.data plus patterns data'
);
} catch (err) {
logger.warning('There was an error parsing JSON for patternlab.data');
logger.warning(err);
logger.error('There was an error parsing JSON for patternlab.data');
logger.error(err);
}
allFooterData.patternLabFoot = footerPartial;

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/lib/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ module.exports = async function (pattern, patternlab) {
'config.paths.source.data global data'
);
} catch (err) {
logger.info(
logger.error(
'There was an error parsing JSON for ' + pattern.relPath
);
logger.info(err);
logger.error(err);
}
allFooterData = _.merge(allFooterData, pattern.jsonFileData);
allFooterData.cacheBuster = patternlab.cacheBuster;
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/lib/loadPattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ module.exports = function (relPath, patternlab) {
);
}
} catch (err) {
logger.warning(
logger.error(
`There was an error parsing sibling JSON for ${currentPattern.relPath}`
);
logger.warning(err);
logger.error(err);
}

//look for a listitems.json file for this template
Expand All @@ -118,10 +118,10 @@ module.exports = function (relPath, patternlab) {
buildListItems(currentPattern);
}
} catch (err) {
logger.warning(
logger.error(
`There was an error parsing sibling listitem JSON for ${currentPattern.relPath}`
);
logger.warning(err);
logger.error(err);
}

//look for a markdown file for this template
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/lib/parameter_hunter.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ const parameter_hunter = function () {
paramData = JSON.parse(paramStringWellFormed);
} catch (err) {
logger.warning(
`There was an error parsing JSON for ${pattern.relPath}`
`There was a problem parsing JSON parameters for ${pattern.relPath}`
);
logger.warning(err);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/lib/parseLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ module.exports = function (patternlab, obj, key) {
try {
dataObj = JSON.parse(dataObjAsString);
} catch (err) {
logger.warning(`There was an error parsing JSON for ${key}`);
logger.warning(err);
logger.error(`There was an error parsing JSON for ${key}`);
logger.error(err);
}

return dataObj;
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/lib/pseudopattern_hunter.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ pseudopattern_hunter.prototype.find_pseudopatterns = function (
fs.readFileSync(variantFileFullPath, 'utf8')
);
} catch (err) {
logger.warning(
logger.error(
`There was an error parsing pseudopattern JSON for ${currentPattern.relPath}`
);
logger.warning(err);
logger.error(err);
}

//extend any existing data with variant data
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/lib/readDocumentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ module.exports = function (pattern, patternlab, isVariant) {
} catch (err) {
// do nothing when file not found
if (err.code !== 'ENOENT') {
logger.warning(
logger.error(
`There was an error setting pattern keys after markdown parsing of the companion file for pattern ${pattern.patternPartial}${FILE_EXTENSION}`
);
logger.warning(err);
logger.error(err);
}
}

Expand Down
8 changes: 4 additions & 4 deletions packages/plugin-tab/src/tab-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,27 @@ async function findTab(patternlab, pattern) {
}

//copy the file to our output target if found
_.each(patternlab.uikits, uikit => {
_.each(patternlab.uikits, (uikit) => {
fs.copySync(
tabFileName,
path.join(process.cwd(), uikit.outputDir, customFileTypeOutputPath)
);
});
} else {
//otherwise write nothing to the same location - this prevents GET errors on the tab.
_.each(patternlab.uikits, uikit => {
_.each(patternlab.uikits, (uikit) => {
fs.outputFileSync(
path.join(process.cwd(), uikit.outputDir, customFileTypeOutputPath),
''
);
});
}
} catch (err) {
console.log(
console.error(
'plugin-tab: There was an error parsing sibling JSON for ' +
pattern.relPath
);
console.log(err);
console.error(err);
}
}
}
Expand Down