Skip to content

Commit 157729f

Browse files
committed
feat: throw an error when duplicate slug is found
1 parent 4e0f64e commit 157729f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/format/slug.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@ export function make_session_slug_processor({
9797
const slug = processor(url, { separator });
9898
let count;
9999
if ((count = seen_slugs.get(slug))) {
100-
seen_slugs.set(slug, count + 1);
101-
return `${slug}${separator}${count}`;
100+
throw new Error(
101+
`Found duplicate slug: "${slug}" when slugifying: "${url}".
102+
Duplicate slugs are not allowed. You need to take yourself outside and have a word with yourself.`
103+
);
102104
} else {
103105
seen_slugs.set(slug, 1);
104106
return slug;

0 commit comments

Comments
 (0)