jamesdumayBranchIndexing.run() or FolderComputation.run() does not have anything which can be used to get notified in case of error. Same goes for other Run classes, for example WorkflowRun, which is better than FolderComputation or BranchIndexing, here it notifies pipeline run lifecycle and even sets Result object but even there nothing there that sets build exceptions.
I also noticed something in WorkflowRun,there I could call WorkflowRun.getExecutionPromise() that gives instance of SettableFuture, where WorkflowRun sets execution errors.
cliffmeyers suggested an API for log file search that looks for given text (sort of like grep), but this has limited uses and won't work in all cases. Needs proper spec.
Or maybe annotated log file, poc I did during Jenkins hackathon might be something we can take up to show logs in segments.