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

validateJsonSyntax does not place error messages into "errors" #1330

Open
ElectricNroff opened this issue Jan 17, 2025 · 0 comments
Open

validateJsonSyntax does not place error messages into "errors" #1330

ElectricNroff opened this issue Jan 17, 2025 · 0 comments

Comments

@ElectricNroff
Copy link
Contributor

const errors = require('./error')

function validateJsonSyntax (err, req, res, next) {
if (err.status && err.message) {
if (err.message.includes('request entity too large')) {
console.warn('Request failed validation because entity too large')
console.info((JSON.stringify(err)))
return res.status(413).json(error.recordTooLarge(errors))

validateJsonSyntax, unlike validateCveJsonSchema, does not have a local variable named errors. Thus, it is apparently not useful to have errors as the argument to error.recordTooLarge, especially because this is:

recordTooLarge () { // mw
const err = {}
err.error = 'RECORD_TOO_LARGE'
err.message = 'Records must be less than 3.8MB.'
return err
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs Triage
Development

No branches or pull requests

1 participant