#326 Refactoring Throw Exception (affectedRow is undefined)