From c4ad593a5a444699ae840ca927f71ef97291e388 Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Wed, 8 May 2024 14:08:23 +0200 Subject: [PATCH] Added JSDoc types to Sentry - this helps editors with identifying what the types of parameters are --- ghost/core/core/shared/sentry.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ghost/core/core/shared/sentry.js b/ghost/core/core/shared/sentry.js index 02836fa25f..ff5bcda9e3 100644 --- a/ghost/core/core/shared/sentry.js +++ b/ghost/core/core/shared/sentry.js @@ -4,6 +4,11 @@ const SentryKnexTracingIntegration = require('./SentryKnexTracingIntegration'); const sentryConfig = config.get('sentry'); const errors = require('@tryghost/errors'); +/** + * @param {import('@sentry/node').Event} event + * @param {import('@sentry/node').EventHint} hint + * @returns {import('@sentry/node').Event | null} + */ const beforeSend = function (event, hint) { try { const exception = hint.originalException; @@ -69,6 +74,10 @@ const ALLOWED_HTTP_TRANSACTIONS = [ return new RegExp(`^(GET|POST|PUT|DELETE)\\s(?${path}\\/.+|\\/$)`); }); +/** + * @param {import('@sentry/node').Event} event + * @returns {import('@sentry/node').Event | null} + */ const beforeSendTransaction = function (event) { // Drop transactions that are not in the allowed list for (const transaction of ALLOWED_HTTP_TRANSACTIONS) {