Skip to content

Commit 4413232

Browse files
committed
jsdoc, throw on malformed request
1 parent 3909440 commit 4413232

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/express/src/client-requests/course-requests.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ const elodoc = {
116116
language: 'javascript',
117117
};
118118

119+
/**
120+
* Inserts a design document into a course database.
121+
* @param courseID - The ID of the course database.
122+
* @param doc
123+
*/
119124
function insertDesignDoc(
120125
courseID: string,
121126
doc: {
@@ -168,6 +173,10 @@ type CourseConfig = CreateCourse['data'];
168173
async function createCourse(cfg: CourseConfig): Promise<any> {
169174
cfg.courseID = await CourseLookup.add(cfg.name);
170175

176+
if (!cfg.courseID) {
177+
throw new Error('Course ID not found');
178+
}
179+
171180
const courseDBName: string = getCourseDBName(cfg.courseID);
172181
const dbCreation = await CouchDB.db.create(courseDBName);
173182

0 commit comments

Comments
 (0)