Skip to content

Show problematic url #358

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ function* lexer(str: string): Generator<LexToken, LexToken> {
}

if (pos) {
throw new TypeError(`Unterminated quote at ${pos}: ${DEBUG_URL}`);
throw new TypeError(`Unterminated quote at ${pos}: ${str}; Visit ${DEBUG_URL} for more information.`);
}
}

if (!value) {
throw new TypeError(`Missing parameter name at ${i}: ${DEBUG_URL}`);
throw new TypeError(`Missing parameter name at ${i}: ${str}; Visit ${DEBUG_URL} for more information.`);
}

return value;
Expand Down Expand Up @@ -203,7 +203,7 @@ class Iter {
if (value !== undefined) return value;
const { type: nextType, index } = this.peek();
throw new TypeError(
`Unexpected ${nextType} at ${index}, expected ${type}: ${DEBUG_URL}`,
`Unexpected ${nextType} at ${index}, expected ${type}: ${str}; Visit ${DEBUG_URL} for more information.`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have access to str in this method.

);
}

Expand Down Expand Up @@ -575,7 +575,7 @@ function toRegExp(tokens: Flattened[], delimiter: string, keys: Keys) {

if (token.type === "param" || token.type === "wildcard") {
if (!isSafeSegmentParam && !backtrack) {
throw new TypeError(`Missing text after "${token.name}": ${DEBUG_URL}`);
throw new TypeError(`Missing text after "${token.name}": ${str}; Visit ${DEBUG_URL} for more information.`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No original str here either. We need to make some changes to pass it around as some methods support just accepting TokenData only.

}

if (token.type === "param") {
Expand Down
Loading