Skip to content

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

@ElectricNroff

Description

@ElectricNroff

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
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Needs Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions