Skip to content

Commit

Permalink
Include param value in 'where' error message
Browse files Browse the repository at this point in the history
  • Loading branch information
bakerkretzmar committed May 16, 2024
1 parent 8681709 commit 6f88d0c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/js/Route.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export default class Route {
).test(params[segment] ?? '')
) {
throw new Error(
`Ziggy error: '${segment}' parameter does not match required format '${this.wheres[segment]}' for route '${this.name}'.`,
`Ziggy error: '${segment}' parameter '${params[segment]}' does not match required format '${this.wheres[segment]}' for route '${this.name}'.`,
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/js/route.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ describe('route()', () => {
'https://ziggy.dev/where/download/file.html',
);
expect(() => route('pages.optionalExtensionWhere', { extension: '.pdf' })).toThrow(
/'extension' parameter does not match required format/,
/'extension' parameter '\.pdf' does not match required format/,
);
});

Expand All @@ -744,10 +744,10 @@ describe('route()', () => {
'https://ziggy.dev/where/strict-download/file.html',
);
expect(() => route('pages.requiredExtensionWhere', 'x')).toThrow(
/'extension' parameter does not match required format/,
/'extension' parameter 'x' does not match required format/,
);
expect(() => route('pages.requiredExtensionWhere', { extension: '.pdf' })).toThrow(
/'extension' parameter does not match required format/,
/'extension' parameter '\.pdf' does not match required format/,
);
});

Expand Down

0 comments on commit 6f88d0c

Please sign in to comment.