From 9c259d8edea975214eff6dc2e64187904f40bd34 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sat, 23 Mar 2019 08:06:53 +0100 Subject: [PATCH] provide metadata to sentry. datacite/datacite#703 --- app/controllers/dois_controller.rb | 11 +++++------ app/controllers/works_controller.rb | 8 -------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/app/controllers/dois_controller.rb b/app/controllers/dois_controller.rb index dfa1704ce..93d230552 100644 --- a/app/controllers/dois_controller.rb +++ b/app/controllers/dois_controller.rb @@ -8,6 +8,7 @@ class DoisController < ApplicationController prepend_before_action :authenticate_user! before_action :set_doi, only: [:show, :destroy, :get_url] before_action :set_include, only: [:index, :show, :create, :update] + before_action :set_raven_context, only: [:create, :update, :validate] def index authorize! :read, Doi @@ -556,11 +557,9 @@ def safe_params :lastLandingPageStatusResult, :lastLandingPageContentType) end - # def add_metadata_to_bugsnag(report) - # return nil unless params.dig(:data, :attributes, :xml).present? + def set_raven_context + return nil unless params.dig(:data, :attributes, :xml).present? - # report.add_tab(:metadata, { - # metadata: Base64.decode64(params.dig(:data, :attributes, :xml)) - # }) - # end + Raven.extra_context metadata: Base64.decode64(params.dig(:data, :attributes, :xml)) + end end diff --git a/app/controllers/works_controller.rb b/app/controllers/works_controller.rb index 3943baf2b..ff8a5c9a1 100644 --- a/app/controllers/works_controller.rb +++ b/app/controllers/works_controller.rb @@ -150,12 +150,4 @@ def set_include @include = nil end end - - # def add_metadata_to_bugsnag(report) - # return nil unless params.dig(:data, :attributes, :xml).present? - - # report.add_tab(:metadata, { - # metadata: Base64.decode64(params.dig(:data, :attributes, :xml)) - # }) - # end end