Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML detailpage is broken when an external provider is not available and the concept of the detailpage is linked to a concept in the external provider. #851

Open
goessebr opened this issue Aug 23, 2023 · 1 comment

Comments

@goessebr
Copy link
Contributor

Related to #850

An external provider http://vocab.getty.edu/ that we are using was down for some time. A request to http://vocab.getty.edu/ gave us a 503 response. During that time it was not possible to GET the HTML detail pages of concepts that are linked to a concept from an external provider

2023-08-23 14:51:20,834 ERROR [atramhasis.views.exception_views][MainThread] Request could not be executed due to server issues - Request: http://vocab.getty.edu/aat/300007806.rdf. Response: b'<html>\r\n<head><title>503 Service Temporarily Unavailable</title></head>\r\n<body>\r\n<center><h1>503 Service Temporarily Unavailable</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n'.
Traceback (most recent call last):
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/pyramid/tweens.py", line 41, in excview_tween
    response = handler(request)
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/pyramid/router.py", line 143, in handle_request
    response = _call_view(
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/pyramid/view.py", line 674, in _call_view
    response = view_callable(context, request)
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/pyramid/config/views.py", line 170, in attr_view
    return view(context, request)
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/pyramid/config/views.py", line 196, in predicate_wrapper
    return view(context, request)
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/pyramid/viewderivers.py", line 450, in rendered_view
    response = view_renderer.render_view(
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/pyramid/renderers.py", line 443, in render_view
    return self.render_to_response(response, system, request=request)
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/pyramid/renderers.py", line 466, in render_to_response
    result = self.render(value, system_values, request=request)
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/pyramid/renderers.py", line 462, in render
    result = renderer(value, system_values)
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/pyramid_jinja2/__init__.py", line 265, in __call__
    return template.render(system)
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/jinja2/environment.py", line 1291, in render
    self.environment.handle_exception()
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/jinja2/environment.py", line 925, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/thesaurus/templates/thesaurus-concept.jinja2", line 27, in top-level template code
    {% from "thesaurus-macros.jinja2" import
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/thesaurus/templates/thesaurus-layout.jinja2", line 6, in top-level template code
    {% set copyright_year = '2016-2020' %}
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/atramhasis/templates/staticlayout-page.jinja2", line 4, in top-level template code
    {% set copyright_year = copyright_year|default('2014-2021') %}
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/thesaurus/templates/thesaurus-staticlayout.jinja2", line 47, in top-level template code
    {% block content %}
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/thesaurus/templates/thesaurus-concept.jinja2", line 188, in block 'content'
    {{ render_matches(concept.matches, request) }}
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/jinja2/runtime.py", line 828, in _invoke
    rv = self._func(*arguments)
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/atramhasis/templates/macros.jinja2", line 52, in template
    {%- set matchValue = request.skos_registry.get_by_uri(value.uri) %}
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/skosprovider/registry.py", line 318, in get_by_uri
    c = self.get_provider(csuri).get_by_uri(uri)
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/skosprovider_getty/providers.py", line 118, in get_by_uri
    return self.get_by_id(id, change_notes) if 'vocab.getty.edu' in uri else None
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/skosprovider_getty/providers.py", line 92, in get_by_id
    graph = uri_to_graph(f'{self.url}/{id}.rdf', session=self.session)
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/skosprovider_getty/utils.py", line 300, in uri_to_graph
    res = do_get_request(uri, s)
  File "/var/projects/thesaurus/venv/lib/python3.8/site-packages/skosprovider_getty/utils.py", line 317, in do_get_request
    raise ProviderUnavailableException(
skosprovider.exceptions.ProviderUnavailableException: Request could not be executed due to server issues - Request: http://vocab.getty.edu/aat/300007806.rdf. Response: b'<html>\r\n<head><title>503 Service Temporarily Unavailable</title></head>\r\n<body>\r\n<center><h1>503 Service Temporarily Unavailable</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n'.
@koenedaele
Copy link
Member

It should be possible to catch the ProviderUnavailable exception when calling the external match. If such an exception is caught, I would show just the URI (preferably hyperlinked). I think that's actually how it works in the admin backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants