add writeExceptionInDB in all classes