Skip to content

Commit

Permalink
fix: change error messages in parseHTMLToTokens & parseExpensiMarkToR…
Browse files Browse the repository at this point in the history
…anges
  • Loading branch information
BartoszGrajdek committed Apr 11, 2024
1 parent 1557ab1 commit 5157388
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function parseHTMLToTokens(html: string): Token[] {
}
const close = html.indexOf('>', open);
if (close === -1) {
throw new Error('[react-native-live-markdown] Invalid HTML: no matching ">"');
throw new Error('[react-native-live-markdown] Error in function parseHTMLToTokens: Invalid HTML: no matching ">"');
}
tokens.push(['HTML', html.substring(open, close + 1)]);
left = close + 1;
Expand Down Expand Up @@ -245,9 +245,9 @@ function parseExpensiMarkToRanges(markdown: string): Range[] {
const [text, ranges] = parseTreeToTextAndRanges(tree);
if (text !== markdown) {
throw new Error(
`[react-native-live-markdown] Parsing error: the processed text does not match the original markdown input. This may be caused by incorrect parsing functions or invalid input markdown.\nProcessed text: '${JSON.stringify(
`[react-native-live-markdown] Parsing error: the processed text does not match the original Markdown input. This may be caused by incorrect parsing functions or invalid input Markdown.\nProcessed input: '${JSON.stringify(
text,
)}'\nOriginal markdown: '${JSON.stringify(markdown)}'`,
)}'\nOriginal input: '${JSON.stringify(markdown)}'`,
);
}
const sortedRanges = sortRanges(ranges);
Expand Down
6 changes: 3 additions & 3 deletions parser/react-native-live-markdown-parser.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5157388

Please sign in to comment.