Advanced db errors handling