Fixed 500 error on views with incomplete course id in url.

LMS-11217

Added try except in views to catch InvalidKeyError and raised Http404 when an incomplete course id is in url.

Added unit test.
Is this always the case? is there some way we can enforce this or document this?