From a847dbd3d5e312b13cfe8a90844c8f88d3aedc78 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Fri, 12 Jan 2018 12:35:04 +0100 Subject: [PATCH] Fix tool report submission --- .../tools/error_reports/plugins/sentry.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/galaxy/tools/error_reports/plugins/sentry.py b/lib/galaxy/tools/error_reports/plugins/sentry.py index f6ad7710d20..4b7df39a79f 100644 --- a/lib/galaxy/tools/error_reports/plugins/sentry.py +++ b/lib/galaxy/tools/error_reports/plugins/sentry.py @@ -64,6 +64,17 @@ class SentryPlugin(ErrorPlugin): error_message = ERROR_TEMPLATE.format(**extra) # Update context with user information in a sentry-specific manner + + # Getting the url allows us to link to the dataset info page in case + # anything is missing from this report. + try: + url = web.url_for(controller="dataset", + action="show_params", + dataset_id=self.app.security.encode_id(dataset.id), + qualified=True) + except AttributeError: + # The above does not work when handlers are separate from the web handlers + url = None self.app.sentry_client.context.merge({ # User information here also places email links + allows seeing # a list of affected users in the tags/filtering. @@ -71,14 +82,8 @@ class SentryPlugin(ErrorPlugin): 'name': user.username, 'email': user.email, }, - # This allows us to link to the dataset info page in case - # anything is missing from this report. 'request': { - 'url': web.url_for( - controller="dataset", action="show_params", - dataset_id=self.app.security.encode_id(dataset.id), - qualified=True - ) + 'url': url } })