Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise 404, not 500, if circularId is not finite #2776

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/routes/circulars/circulars.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@
circularId: number,
version?: number
): Promise<Circular> {
if (isNaN(circularId) || (version !== undefined && isNaN(version)))
throw new Response(null, { status: 404 })

Check warning on line 244 in app/routes/circulars/circulars.server.ts

View check run for this annotation

Codecov / codecov/patch

app/routes/circulars/circulars.server.ts#L244

Added line #L244 was not covered by tests
const circularVersions = await getDynamoDBVersionAutoIncrement(circularId)
const result = await circularVersions.get(version)
if (!result)
Expand Down Expand Up @@ -367,6 +369,7 @@
* @returns an array of previous versions of a Circular sorted by version
*/
export async function getVersions(circularId: number): Promise<number[]> {
if (isNaN(circularId)) throw new Response(null, { status: 404 })
const circularVersionsAutoIncrement =
await getDynamoDBVersionAutoIncrement(circularId)
return await circularVersionsAutoIncrement.list()
Expand Down
Loading