Add exception handling for invalid course key

PLAT-343