Skip to content

Commit

Permalink
Add missing error HTTP status codes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydenseric committed Jul 19, 2018
1 parent aad9e11 commit 2a507ee
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/middleware.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ export const processRequest = (
stream.on('limit', () =>
capacitor.destroy(
new MaxFileSizeUploadError(
'File truncated as it exceeds the size limit.'
'File truncated as it exceeds the size limit.',
413
)
)
)
Expand Down Expand Up @@ -175,7 +176,9 @@ export const processRequest = (
})

parser.once('filesLimit', () => {
exit(new MaxFilesUploadError(`${maxFiles} max file uploads exceeded.`))
exit(
new MaxFilesUploadError(`${maxFiles} max file uploads exceeded.`, 413)
)
})

parser.once('finish', () => {
Expand All @@ -186,7 +189,7 @@ export const processRequest = (
for (const upload of map.values())
if (!upload.file)
upload.reject(
new FileMissingUploadError('File missing in the request.')
new FileMissingUploadError('File missing in the request.', 400)
)
})

Expand Down

0 comments on commit 2a507ee

Please sign in to comment.