Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Commit

Permalink
feat(Elife): Throw error on request for invalid PDF type
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcmoulton committed May 13, 2020
1 parent b255280 commit fcd8e75
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/themes/elife/lib/dataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ const getPdfUrl: PdfUrlGetter = async (
): Promise<string> => {
const allowedPdfTypes = ['article', 'figures']
if (!allowedPdfTypes.includes(pdfType)) {
return ''
throw new Error(
`Requested Invalid PDF type: "${pdfType}", must be one of ${allowedPdfTypes.join(
', '
)}.`
)
}
const response = await query(id, window.fetch)
if (pdfType === 'figures') {
Expand Down

0 comments on commit fcd8e75

Please sign in to comment.