Skip to content

Commit

Permalink
chore: refer to malformed pages as malformed instead of invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
SethFalco committed Mar 2, 2024
1 parent 205774b commit 2e33d58
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ export function parseTldrPage(source: string): TldrPage {
const markdownTokens = lexer.lex(source);

if (markdownTokens[0].type !== 'heading' || markdownTokens[1].type !== 'blockquote') {
throw new Error('Invalid tldr page provided.');
throw new Error('Malformed tldr page provided.');
}

const name = markdownTokens[0].text;
const descriptionText = markdownTokens[1].tokens?.[0];

if (descriptionText?.type !== 'paragraph') {
throw new Error('Invalid tldr page provided.');
throw new Error('Malformed tldr page provided.');
}

const descriptionTokens = descriptionText.tokens;
Expand Down Expand Up @@ -98,7 +98,7 @@ export function parseTldrPage(source: string): TldrPage {

while (index < markdownTokens.length) {
if (markdownTokens[index].type !== 'list' || markdownTokens[index + 2].type !== 'paragraph') {
throw new Error('Invalid tldr page provided.');
throw new Error('Malformed tldr page provided.');
}

const description = (markdownTokens[index] as any).items[0].text;
Expand Down

0 comments on commit 2e33d58

Please # to comment.