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

NN-4019: Re-instate catch wrapper for probation docs #2169

Merged
Show file tree
Hide file tree
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
9 changes: 4 additions & 5 deletions backend/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,13 @@ import homepageController from './controllers/homepage/homepage'
import deprecatedUrlPage from './controllers/deprecatedUrlPage'
import requestLimiter from './middleware/requestLimiter'

process.on('uncaughtExceptionMonitor', (err, origin) => {
logError('UncuaghtExcMon', err, origin)
})
// We do not want the server to exit, partly because any log information will be lost.
// Instead, log the error so we can trace, diagnose and fix the problem.
process.on('uncaughtException', (err, origin) => {
logError('UncuaghtExc', err, origin)
logError('uncaughtException', err, origin)
})
process.on('unhandledRejection', (reason, promise) => {
console.log('Unhandled Rejection at: ', promise, 'reason:', reason)
logError(`unhandledRejection`, {}, `Unhandled Rejection at: ${promise} reason: ${reason}`)
})

const app = express()
Expand Down
5 changes: 4 additions & 1 deletion backend/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import appointmentConfirmDeletion from './controllers/appointmentConfirmDeletion
import appointmentDeleteRecurringBookings from './controllers/appointmentDeleteRecurringBookings'
import appointmentDeleted from './controllers/appointmentDeleted'
import { cacheFactory } from './utils/singleValueInMemoryCache'
import asyncMiddleware from './middleware/asyncHandler'

import whereaboutsRouter from './routes/whereabouts/whereaboutsRouter'

Expand Down Expand Up @@ -137,7 +138,9 @@ const setup = ({

router.get(
'/offenders/:offenderNo/probation-documents',
probationDocumentsFactory(oauthApi, prisonApi, communityApi, systemOauthClient).displayProbationDocumentsPage
asyncMiddleware(
probationDocumentsFactory(oauthApi, prisonApi, communityApi, systemOauthClient).displayProbationDocumentsPage
)
)
router.get(
'/offenders/:offenderNo/probation-documents/:documentId/download',
Expand Down