(errors: ErrorObject[])
| 12 | }; |
| 13 | |
| 14 | const getError = (errors: ErrorObject[]): ErrorObject => { |
| 15 | // This is a guard against accidentally enabling allErrors in ajv and making |
| 16 | // the server more vulnerable to DOS. |
| 17 | const error = errors[0]; |
| 18 | if (!error || errors.length !== 1) { |
| 19 | throw new Error( |
| 20 | 'Bad Argument: the array of errors must have exactly one element.' |
| 21 | ); |
| 22 | } |
| 23 | return error; |
| 24 | }; |
| 25 | |
| 26 | /** |
| 27 | * Format validation errors for /project-completed. |
no outgoing calls
no test coverage detected