Skip to content

Commit afc1286

Browse files
committed
fix: next function does not exist
1 parent 71e87e7 commit afc1286

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

server/src/cloud-function.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ enum Privacy {
2121
Private = 2,
2222
}
2323

24-
export const serve = async (request: Request, response: Response, next: NextFunction): Promise<void> => {
24+
export const serve = async (request: Request, response: Response): Promise<void> => {
2525
try {
2626
const fullName = request.query.fullName
2727
if (typeof fullName !== 'string') {
@@ -45,7 +45,7 @@ export const serve = async (request: Request, response: Response, next: NextFunc
4545
}
4646
entry.resume()
4747
}
48-
})().catch(next)
48+
})().catch(error => tarStream.emit('error', error))
4949
})
5050
await once(tarStream, 'end')
5151
console.log('Making request to Codesandbox for', fullName)
@@ -56,7 +56,7 @@ export const serve = async (request: Request, response: Response, next: NextFunc
5656
sandbox: decamelizeKeys({
5757
...sandbox,
5858
collectionId,
59-
title: `Submission by ${fullName}`,
59+
title: `${fullName} - Coding exercise submission`,
6060
private: Privacy.Private,
6161
}),
6262
}
@@ -76,8 +76,7 @@ export const serve = async (request: Request, response: Response, next: NextFunc
7676
console.error(error.response.body)
7777
}
7878
response.status(error.status ?? 500).send(error?.response?.body || error.message)
79-
next(error)
80-
return
79+
throw error
8180
}
8281
}
8382

0 commit comments

Comments
 (0)