Skip to content

Commit

Permalink
handle errors gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
madebyzak committed Feb 12, 2025
1 parent aa5827d commit 0224e29
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions server/routes/applications/viewApplicationsRoutes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Request, Response, Router } from 'express'

import { APPLICATION_TYPES } from '../../constants/applicationTypes'
import asyncMiddleware from '../../middleware/asyncMiddleware'
import AuditService, { Page } from '../../services/auditService'
Expand All @@ -19,7 +18,7 @@ export default function viewApplicationRoutes({ auditService }: { auditService:
}

if (!application) {
res.status(404).send('Application not found')
res.redirect('/applications')
return
}

Expand All @@ -31,7 +30,7 @@ export default function viewApplicationRoutes({ auditService }: { auditService:
const applicationType = APPLICATION_TYPES.find(type => type.value === application.type)

if (!applicationType) {
res.status(400).send('Invalid application type')
res.redirect('/applications?error=unknown-type')
return
}

Expand Down

0 comments on commit 0224e29

Please sign in to comment.