Rearranged and adjusted the old Typing_context module to work exactly as the new one.
Plus a little error handling code refactoring in both versions.
Modified repository_constraints.ml and resource_constraints.ml accordingly.