From f01b6fc1b147c4ac3af2d608223dbb7e4e984c06 Mon Sep 17 00:00:00 2001 From: Andrew Herzberg Date: Wed, 11 Dec 2024 11:19:04 -0700 Subject: [PATCH] log mobile push errors (#19813) --- config/features.yml | 3 +++ .../v0/push_notifications_controller.rb | 25 +++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/config/features.yml b/config/features.yml index e9f44fc1c0e..82276d54b2f 100644 --- a/config/features.yml +++ b/config/features.yml @@ -1658,6 +1658,9 @@ features: appointment_provider_id_logging: actor_type: user description: For mobile app, logs provider id for debugging + mobile_push_register_logging: + actor_type: user + description: For mobile app, logs push register errors for debugging form526_backup_submission_temp_killswitch: actor_type: user description: Provide a temporary killswitch to disable form526 backup submission if something were to go awry diff --git a/modules/mobile/app/controllers/mobile/v0/push_notifications_controller.rb b/modules/mobile/app/controllers/mobile/v0/push_notifications_controller.rb index adb091201e9..49ef192b1c9 100644 --- a/modules/mobile/app/controllers/mobile/v0/push_notifications_controller.rb +++ b/modules/mobile/app/controllers/mobile/v0/push_notifications_controller.rb @@ -6,13 +6,24 @@ module Mobile module V0 class PushNotificationsController < ApplicationController def register - result = service.register( - get_app_name(params), - params[:device_token], - @current_user.icn, - params[:os_name], - params[:device_name] || params[:os_name] - ) + begin + result = service.register( + get_app_name(params), + params[:device_token], + @current_user.icn, + params[:os_name], + params[:device_name] || params[:os_name] + ) + rescue => e + if Flipper.enabled?(:mobile_push_register_logging, @current_user) + PersonalInformationLog.create!( + data: { icn: @current_user.icn, message: e.message, backtrace: e.backtrace }, + error_class: 'Mobile Push Register Error' + ) + end + + raise e + end render json: Mobile::V0::PushRegisterSerializer.new(params[:app_name], result.body[:sid]) end