Is this an inversion? To V should S be . .
The sentences are not equivalent in meaning. That is, the first makes sense, the second doesn't.
Probably your confusion lies in the word should. Here it means if. I would expand it like this:
If the reason was to avoid bad publicity [if] his error [were to] be discovered, then . . .