Make get_errored_courses part of the modulestore API (with default implementation).

Also clarifies the contraction of location.course_id by throwing an exception for lcoations that are not of category course.

Add test for course_id method.