Adding try-catch to controllers/general.py