(result, dataVar, schemaErrorFormatter)
| 254 | } |
| 255 | |
| 256 | function wrapValidationError (result, dataVar, schemaErrorFormatter) { |
| 257 | if (result instanceof Error) { |
| 258 | result.statusCode = result.statusCode || 400 |
| 259 | result.code = result.code || 'FST_ERR_VALIDATION' |
| 260 | result.validationContext = result.validationContext || dataVar |
| 261 | return result |
| 262 | } |
| 263 | |
| 264 | const error = schemaErrorFormatter(result, dataVar) |
| 265 | error.statusCode = error.statusCode || 400 |
| 266 | error.code = error.code || 'FST_ERR_VALIDATION' |
| 267 | error.validation = result |
| 268 | error.validationContext = dataVar |
| 269 | return error |
| 270 | } |
| 271 | |
| 272 | module.exports = { |
| 273 | symbols: { bodySchema, querystringSchema, responseSchema, paramsSchema, headersSchema }, |
no outgoing calls
no test coverage detected