updated and centralized exception handling for controllers