Marked: Calling marked() with undefined results in unclear error

Created on 3 Jul 2014  路  2Comments  路  Source: markedjs/marked

When calling marked(undefined), you get the error TypeError: Cannot read property 'replace' of undefined Please report this to https://github.com/chjj/marked..

This error message is not helpful. Either return an empty string, or raise some kind of ArgumentException. This will help de caller identify the problem quicker.

Most helpful comment

Easies way is to not pass undefined to marked, e.g.: marked(myString || '') -- solved.

All 2 comments

+1

Easies way is to not pass undefined to marked, e.g.: marked(myString || '') -- solved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

learykara picture learykara  路  3Comments

FireflyAndStars picture FireflyAndStars  路  3Comments

elennaro picture elennaro  路  4Comments

eGavr picture eGavr  路  4Comments

samit4me picture samit4me  路  3Comments