import { Errors } from "io-ts" ; import { errorsToReadableMessages } from "italia-ts-commons/lib/reporters" ; import { ProblemJson } from "italia-ts-commons/lib/responses" ; param errors param context returns export function multipleErrorsFormatter ( errors , context ) { return new Error ( errors . map ( _ => `value [${ _ . message }]` ) . join ( ` at [context: ${ context }]\n` ) ) ; } export const errorsToError = ( errors ) : Error => new Error ( errorsToReadableMessages ( errors ) . join ( " / " ) ) ; export const readableProblem = ( problem ) => `${ problem . title } (${ problem . type || "no problem type specified" })` ;