Added conditional to raise execptions when app is in debug mode