Skip to content

Commit

Permalink
Merge pull request #612 from camptocamp/fix-sentry2
Browse files Browse the repository at this point in the history
Use standard pages on error
  • Loading branch information
sbrunner authored Nov 18, 2024
2 parents 0f88abc + 75df6aa commit d7e7806
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions github_app_geo_project/views/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
@view_config(route_name="logs", renderer="github_app_geo_project:templates/logs.html") # type: ignore
def logs_view(request: pyramid.request.Request) -> dict[str, Any]:
"""Get the logs of a job."""
if not request.is_authenticated:
raise pyramid.httpexceptions.HTTPForbidden()

title = f"Logs of job {request.matchdict['id']}"
logs = "Element not found"
has_access = True
Expand All @@ -37,8 +40,7 @@ def logs_view(request: pyramid.request.Request) -> dict[str, Any]:
if has_access:
logs = job.log
else:
request.response.status = 302
logs = "Access Denied"
raise pyramid.httpexceptions.HTTPUnauthorized()
return {
"title": title,
"logs": logs,
Expand All @@ -51,10 +53,4 @@ def logs_view(request: pyramid.request.Request) -> dict[str, Any]:
),
}
else:
request.response.status = 404
return {
"title": title,
"logs": logs,
"reload": False,
"favicon_postfix": "red",
}
raise pyramid.httpexceptions.HTTPNotFound()

0 comments on commit d7e7806

Please sign in to comment.