toErrors

private inline fun <K : ReportKind, U : ReportUnit> List<ReportUnit>.toErrors(): K?

Collects error report units of concrete type U in this to produce top-level key for error kind K.

This is generic for different error kinds because they follow the same static nature of report fields, in which all fields are constant and must be present, as opposed to toStageReports.

Usage:

  • To make config errors (K = ReportT.ConfigError), pass in U = ReportT.ConfigUnitError.

  • To make context errors (K = ReportT.ContextError), pass in U = ReportT.ContextUnitError.

  • To make pipeline errors (K = ReportT.PipelineError), pass in U = ReportT.PipelineErrorUnit.