apluslms / radar

Web service for analyzing program code similarity
4 stars 10 forks source link

Radar crashes in course settings: Missing required configuration key: get_exercise_template #27

Closed markkuriekkinen closed 2 years ago

markkuriekkinen commented 2 years ago

Server crashes. If the course is missing mandatory configurations, the server should not crash, but show a useful error message to the user.

Internal Server Error: /COURSEKEY/ID/settings/

ConfigError at /COURSEKEY/ID/settings/
Missing required configuration key: get_exercise_template

Request Method: GET
Request URL: /COURSEKEY/ID/settings/

Traceback:
File "/srv/radar/venv/lib/python3.8/site-packages/django/core/handlers/exception.py" in inner
  34.             response = get_response(request)
File "/srv/radar/venv/lib/python3.8/site-packages/django/core/handlers/base.py" in _get_response
  115.                 response = self.process_exception_by_middleware(e, request)
File "/srv/radar/venv/lib/python3.8/site-packages/django/core/handlers/base.py" in _get_response
  113.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/srv/radar/venv/lib/python3.8/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
  21.                 return view_func(request, *args, **kwargs)
File "/srv/radar/radar/review/decorators.py" in _wrapped_view
  32.         return view_func(request, *args, **kwargs)
File "/srv/radar/radar/review/views.py" in exercise_settings
  342.     template_source = configured_function(p_config, 'get_exercise_template')(exercise, p_config)
File "/srv/radar/radar/./radar/config.py" in configured_function
  24.         raise ConfigError("Missing required configuration key: %s" % (key))
markkuriekkinen commented 2 years ago

The teacher says that this bug occurs like this:

  1. go to the page where all exercises are listed
  2. press the Settings button next to one exercise
  3. server crashes: 500 internal server error
markkuriekkinen commented 2 years ago

This was caused by outdated local_settings.py that were missing some keys in the PROVIDERS setting.

It would be better if Radar didn't crash when the configuration is faulty, but let's not worry about that now.