Skip to content

Commit 52a9db2

Browse files
committed
throw crsConfig fetch errors
1 parent e822e00 commit 52a9db2

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

packages/db/src/impl/pouch/courseAPI.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,17 @@ async function addCard(
136136
return card;
137137
}
138138

139-
export async function getCredentialledCourseConfig(courseID: string) {
140-
const db = getCourseDB(courseID);
141-
const ret = await db.get<CourseConfig>('CourseConfig');
142-
ret.courseID = courseID;
143-
console.log(`Returning course config:
144-
145-
${JSON.stringify(ret)}
146-
`);
147-
148-
return ret;
139+
export async function getCredentialledCourseConfig(courseID: string): Promise<CourseConfig> {
140+
try {
141+
const db = getCourseDB(courseID);
142+
const ret = await db.get<CourseConfig>('CourseConfig');
143+
ret.courseID = courseID;
144+
console.log(`Returning course config: ${JSON.stringify(ret)}`);
145+
return ret;
146+
} catch (e) {
147+
console.error(`Error fetching config for ${courseID}:`, e);
148+
throw e;
149+
}
149150
}
150151

151152
/**

0 commit comments

Comments
 (0)