Skip to content

Commit

Permalink
Merge pull request #75 from tedyu/error-prefix
Browse files Browse the repository at this point in the history
Add prefix string to error log
  • Loading branch information
zuchka authored Aug 2, 2024
2 parents c36e440 + 9d9b183 commit b770b23
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = function(md, options) {
options.abbr = options.hasOwnProperty('abbr') ? options.abbr : false;
options.replaceLinksWithURL = options.hasOwnProperty('replaceLinksWithURL') ? options.replaceLinksWithURL : false;
options.htmlTagsToSkip = options.hasOwnProperty('htmlTagsToSkip') ? options.htmlTagsToSkip : [];
options.throwError = options.hasOwnProperty('throwError') ? options.throwError : false;

var output = md || '';

Expand Down Expand Up @@ -89,7 +90,9 @@ module.exports = function(md, options) {
// Replace strike through
.replace(/~(.*?)~/g, '$1');
} catch(e) {
console.error(e);
if (options.throwError) throw e;

console.error("remove-markdown encountered error: %s", e);
return md;
}
return output;
Expand Down

0 comments on commit b770b23

Please sign in to comment.