r17514: Simplify the way to set ldb errors and add another