DNN-3706 Better management for sql errors