error handle and db