Skip to content

Commit 712ce0e

Browse files
author
Peter Bengtsson
authored
Port trigger-error.js to TypeScript (#51185)
1 parent 321adf2 commit 712ce0e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/frame/middleware/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import archivedEnterpriseVersions from '@/archives/middleware/archived-enterpris
3535
import robots from './robots'
3636
import earlyAccessLinks from '@/early-access/middleware/early-access-links'
3737
import categoriesForSupport from './categories-for-support'
38-
import triggerError from '@/observability/middleware/trigger-error.js'
38+
import triggerError from '@/observability/middleware/trigger-error'
3939
import secretScanning from '@/secret-scanning/middleware/secret-scanning.js'
4040
import ghesReleaseNotes from '@/release-notes/middleware/ghes-release-notes.js'
4141
import whatsNewChangelog from './context/whats-new-changelog.js'

src/observability/middleware/trigger-error.js renamed to src/observability/middleware/trigger-error.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1+
import type { Response, NextFunction } from 'express'
2+
3+
import type { ExtendedRequest } from '@/types'
4+
15
// This module is for testing our handling of uncaught async rejections on incoming requests
26

37
// IMPORTANT: Leave this function as `async` even though it doesn't need to be!
4-
export default async function triggerError(req, res, next) {
8+
export default async function triggerError(
9+
req: ExtendedRequest,
10+
res: Response,
11+
next: NextFunction,
12+
) {
513
// IMPORTANT:
614
// Do NOT wrap this method's contents in the usual `try-catch+next(error)`
715
// pattern used on async middleware! This is an intentional omission!

0 commit comments

Comments
 (0)