Display a better error message when MyLA is launched from a server without access
Opened this issue · 0 comments
jonespm commented
Expected behavior (A description of what you expected to happen) :
A better message should be displayed when MyLA is launched from an environment that doesn't have access (For instance Prod launching to Test)
Describe the bug (Tell us what happens instead of the expected behavior) :
When myla (prod for instance) is launched from Test is just displays
Server Error (500)
The internal error that is displayed is something like this:
We should catch this and return a more appropriate message like "This platform is not configured to launch into this MyLA instance. Please check that you are using the correct instance for your environment"
[2022-06-29 12:18:01 -0400] [ERROR] [log.py:224] Internal Server Error: /lti/login/
--
| Traceback (most recent call last):
| File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
| response = get_response(request)
| File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
| response = wrapped_callback(request, *callback_args, **callback_kwargs)
| File "/usr/local/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
| return view_func(*args, **kwargs)
| File "/code/dashboard/lti_new.py", line 273, in login
| return oidc_login.enable_check_cookies().redirect(target_link_uri)
| File "/usr/local/lib/python3.8/site-packages/pylti1p3/oidc_login.py", line 167, in redirect
| redirect_obj = self._prepare_redirect(launch_url)
| File "/usr/local/lib/python3.8/site-packages/pylti1p3/oidc_login.py", line 149, in _prepare_redirect
| auth_login_return_url = self._prepare_redirect_url(launch_url)
| File "/usr/local/lib/python3.8/site-packages/pylti1p3/oidc_login.py", line 105, in _prepare_redirect_url
| self._registration = self.validate_oidc_login()
| File "/usr/local/lib/python3.8/site-packages/pylti1p3/oidc_login.py", line 192, in validate_oidc_login
| registration = self._tool_config.find_registration(iss, action=Action.OIDC_LOGIN, request=self._request)
| File "/usr/local/lib/python3.8/site-packages/pylti1p3/tool_config/abstract.py", line 68, in find_registration
| return self.find_registration_by_issuer(iss, *args, **kwargs)
| File "/usr/local/lib/python3.8/site-packages/pylti1p3/tool_config/dict.py", line 123, in find_registration_by_issuer
| iss_conf = self.get_iss_config(iss)
| File "/usr/local/lib/python3.8/site-packages/pylti1p3/tool_config/dict.py", line 178, in get_iss_config
| raise Exception('iss %s not found in settings' % iss)