Proper CdbException handling

Also fix up usage of print while we're here

Change-Id: Ib7af23f2dc9c65cfd9b4c3b009d358f968a910b2
Merge "Proper CdbException handling"