(result, dataVar, schemaErrorFormatter)
| 245 | } |
| 246 | |
| 247 | function wrapValidationError (result, dataVar, schemaErrorFormatter) { |
| 248 | if (result instanceof Error) { |
| 249 | result.statusCode = result.statusCode || 400 |
| 250 | result.code = result.code || 'FST_ERR_VALIDATION' |
| 251 | result.validationContext = result.validationContext || dataVar |
| 252 | return result |
| 253 | } |
| 254 | |
| 255 | const error = schemaErrorFormatter(result, dataVar) |
| 256 | error.statusCode = error.statusCode || 400 |
| 257 | error.code = error.code || 'FST_ERR_VALIDATION' |
| 258 | error.validation = result |
| 259 | error.validationContext = dataVar |
| 260 | return error |
| 261 | } |
| 262 | |
| 263 | module.exports = { |
| 264 | symbols: { bodySchema, querystringSchema, responseSchema, paramsSchema, headersSchema }, |
no outgoing calls
no test coverage detected