Capture compilation errors only found when building the full relationship graph

Reimplementation of #152 in a cleaner way that allows the use of `and_raise_error` chain.