Move metric to try body

This commit is contained in:
Eric Bailey
2025-03-06 14:11:57 -06:00
parent 5ee3c49cd2
commit df57012f85
@@ -134,12 +134,21 @@ let ProfileHeaderLabeler = ({
const onPressSubscribe = React.useCallback( const onPressSubscribe = React.useCallback(
() => () =>
requireAuth(async (): Promise<void> => { requireAuth(async (): Promise<void> => {
const willSubscribe = !isSubscribed const subscribe = !isSubscribed
try { try {
await toggleSubscription({ await toggleSubscription({
did: profile.did, did: profile.did,
subscribe: !isSubscribed, subscribe,
}) })
logger.metric(
subscribe
? 'moderation:subscribedToLabeler'
: 'moderation:unsubscribedFromLabeler',
{},
{statsig: true},
)
} catch (e: any) { } catch (e: any) {
reset() reset()
if (e.message === 'MAX_LABELERS') { if (e.message === 'MAX_LABELERS') {
@@ -147,17 +156,6 @@ let ProfileHeaderLabeler = ({
return return
} }
logger.error(`Failed to subscribe to labeler`, {message: e.message}) logger.error(`Failed to subscribe to labeler`, {message: e.message})
return
}
if (willSubscribe) {
logger.metric('moderation:subscribedToLabeler', {}, {statsig: true})
} else {
logger.metric(
'moderation:unsubscribedFromLabeler',
{},
{statsig: true},
)
} }
}), }),
[ [