Search in sources :

Example 1 with SingleErrorBuilder

use of com.helger.commons.error.SingleError.SingleErrorBuilder in project ph-schematron by phax.

the class AbstractCollectingPSErrorHandler method handle.

@Override
protected void handle(@Nullable final IReadableResource aRes, @Nonnull final IErrorLevel aErrorLevel, @Nullable final IPSElement aSourceElement, @Nonnull final String sMessage, @Nullable final Throwable t) {
    final SingleErrorBuilder aBuilder = SingleError.builder().setErrorLevel(aErrorLevel).setErrorLocation(aRes == null ? null : new SimpleLocation(aRes.getResourceID())).setErrorText(sMessage).setLinkedException(t);
    if (aSourceElement != null) {
        String sField = ClassHelper.getClassLocalName(aSourceElement);
        if (aSourceElement instanceof IPSHasID && ((IPSHasID) aSourceElement).hasID())
            sField += " [ID=" + ((IPSHasID) aSourceElement).getID() + "]";
        aBuilder.setErrorFieldName(sField);
    }
    m_aErrorList.add(aBuilder.build());
}
Also used : SingleErrorBuilder(com.helger.commons.error.SingleError.SingleErrorBuilder) IPSHasID(com.helger.schematron.pure.model.IPSHasID) SimpleLocation(com.helger.commons.location.SimpleLocation)

Aggregations

SingleErrorBuilder (com.helger.commons.error.SingleError.SingleErrorBuilder)1 SimpleLocation (com.helger.commons.location.SimpleLocation)1 IPSHasID (com.helger.schematron.pure.model.IPSHasID)1