Skip to content

Commit 50f9d73

Browse files
committed
🐛 Fix error handling (#2020)
1 parent 27b1d25 commit 50f9d73

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/services/workbooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ export async function getWorkBookByUrlSlug(urlSlug: string): Promise<WorkBook |
6464
// See:
6565
// https://www.prisma.io/docs/orm/prisma-schema/data-model/relations#create-a-record-and-nested-records
6666
export async function createWorkBook(workBook: WorkBook): Promise<void> {
67-
const slug = workBook.urlSlug as string;
67+
const slug = workBook.urlSlug;
6868

69-
if (await isExistingUrlSlug(slug)) {
69+
if (slug && (await isExistingUrlSlug(slug))) {
7070
throw new Error(`WorkBook slug ${slug} has already existed`);
7171
}
7272

0 commit comments

Comments
 (0)