2026-07-20 16:05:17 +00:00
// Module ID: 1185
2026-07-25 08:10:48 +00:00
// Function ID: 13513
2026-07-20 16:05:17 +00:00
// Name: _maybeBackfillMissingBreadcrumbsFromTelemetryRing
2026-07-27 11:26:19 +00:00
// Dependencies: [5, 27, 653, 482, 787, 3, 1186, 1198, 675, 13189, 5839, 5844, 13190, 1184, 1554, 5840, 477, 4111, 1553, 5907, 650, 3995, 2]
2026-07-20 16:05:17 +00:00
// Exports: initSentry
// Module 1185 (_maybeBackfillMissingBreadcrumbsFromTelemetryRing)
2026-07-23 10:11:24 +00:00
import timestamp from "timestamp" ;
import { NativeModules } from "get ActivityIndicator" ;
import ME from "ME" ;
import { PRIMARY_DOMAIN } from "sum" ;
import addBreadcrumb from "addBreadcrumb" ;
import importDefaultResult from "sum" ;
import IGNORE_ANALYTICS_BREADCRUMB_EVENTS from "IGNORE_ANALYTICS_BREADCRUMB_EVENTS" ;
2026-07-20 16:05:17 +00:00
let Endpoints ;
2026-07-23 10:11:24 +00:00
let closure_6 ;
const require = arg1 ;
async function _maybeBackfillMissingBreadcrumbsFromTelemetryRing ( arg0 , arg1 ) {
const breadcrumbs = arg0 . breadcrumbs ;
2026-07-20 16:05:17 +00:00
if ( ! Array . isArray ( breadcrumbs ) ) {
2026-07-23 10:11:24 +00:00
const SentryTelemetry = outer2_0 ( outer2_3 [ 6 ] ) . SentryTelemetry ;
2026-07-20 16:05:17 +00:00
const items = [ SentryTelemetry . snapshotForBreadcrumbs ( ) , ] ;
2026-07-23 10:11:24 +00:00
const promise = new Promise ( ( arg0 , arg1 ) = > {
let closure_0 = arg1 ;
return setTimeout ( ( ) = > {
const error = new Error ( "TelemetryRing breadcrumb timeout" ) ;
return callback ( error ) ;
} , 200 ) ;
} ) ;
2026-07-20 16:05:17 +00:00
items [ 1 ] = promise ;
const tmp7 = yield Promise . race ( items ) . catch ( ( ) = > null ) ;
let isArray = null != tmp7 ;
if ( isArray ) {
const _Array = Array ;
isArray = Array . isArray ( tmp7 . entries ) ;
}
if ( isArray ) {
isArray = 0 !== tmp7 . entries . length ;
}
if ( isArray ) {
const entries = tmp7 . entries ;
2026-07-23 10:11:24 +00:00
arg0 . breadcrumbs = entries . map ( ( message ) = > {
2026-07-20 16:05:17 +00:00
const obj = { } ;
let key = message . message ;
if ( null == key ) {
key = message . key ;
}
obj . message = key ;
obj . category = "telemetry_ring" ;
obj . timestamp = message . timestamp / 1000 ;
obj . data = message . data ;
return obj ;
} ) ;
}
const racePromise = Promise . race ( items ) ;
}
}
function filterError ( event_id , originalException ) {
2026-07-23 10:11:24 +00:00
let closure_0 = event_id ;
let closure_1 = originalException ;
2026-07-20 16:05:17 +00:00
originalException = undefined ;
if ( null != originalException ) {
originalException = originalException . originalException ;
}
let status ;
if ( null != originalException ) {
status = originalException . status ;
}
if ( ! status ) {
let captchaFields ;
if ( null != originalException ) {
captchaFields = originalException . captchaFields ;
}
let tmp4 = null ;
if ( null != captchaFields ) {
let code ;
if ( null != originalException ) {
code = originalException . code ;
}
tmp4 = code ;
}
let flag = false ;
if ( tmp4 ) {
flag = false ;
if ( tmp4 < 0 ) {
flag = true ;
}
}
} else {
flag = true ;
}
if ( ! flag ) {
let originalException1 ;
if ( null != originalException ) {
originalException1 = originalException . originalException ;
}
let code1 ;
if ( null != originalException1 ) {
if ( null != originalException1 . err ) {
code1 = err . code ;
}
}
let flag2 = false ;
if ( "ABORTED" === code1 ) {
flag2 = true ;
}
flag = flag2 ;
}
if ( flag ) {
markCrashHandled ( event_id . event_id ) ;
} else {
let originalException2 ;
if ( null != originalException ) {
originalException2 = originalException . originalException ;
}
let status1 ;
if ( null != originalException2 ) {
status1 = originalException2 . status ;
}
if ( null != status1 ) {
if ( null == event_id . tags ) {
event_id . tags = { } ;
}
event_id . tags . httpStatusCode = status1 ;
}
2026-07-23 10:11:24 +00:00
let tmp10 = c12 ;
2026-07-20 16:05:17 +00:00
if ( "error" === event_id . level ) {
2026-07-23 10:11:24 +00:00
tmp10 = c13 ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if ( ! c14 ) {
2026-07-20 16:05:17 +00:00
trackCrash ( event_id , originalException , false ) ;
}
return callback ( async ( ) = > {
2026-07-23 10:11:24 +00:00
const ZoomedInTelemetry = callback ( outer2_3 [ 6 ] ) . ZoomedInTelemetry ;
2026-07-20 16:05:17 +00:00
const items = [ ZoomedInTelemetry . flushNow ( ) , new Promise ( ( arg0 ) = > setTimeout ( arg0 , 200 ) ) ] ;
yield Promise . race ( items ) ;
2026-07-23 10:11:24 +00:00
yield ( function maybeBackfillMissingBreadcrumbsFromTelemetryRing ( outer1_0 ) {
return outer3_16 ( . . . arguments ) ;
} ) ( outer1_0 ) ;
outer2_20 ( outer1_0 , outer1_1 ) ;
2026-07-20 16:05:17 +00:00
} ) ( ) ;
}
return null ;
}
function getCrashErrorMessage ( exception ) {
let type ;
let value ;
exception = exception . exception ;
let first ;
if ( null != exception ) {
const values = exception . values ;
if ( null != values ) {
first = values [ 0 ] ;
}
}
if ( null == first ) {
const extra2 = exception . extra ;
let prop ;
if ( null != extra2 ) {
prop = extra2 . persisted_error_message ;
}
let message ;
if ( "string" === typeof prop ) {
if ( prop . length > 0 ) {
message = prop ;
}
}
if ( null == message ) {
message = exception . message ;
}
return message ;
} else {
( { type , value } = first ) ;
if ( null != type ) {
if ( null != value ) {
const _HermesInternal = HermesInternal ;
return "" + type + ": " + value ;
}
}
const extra = exception . extra ;
if ( null != extra ) {
const prop1 = extra . persisted_error_message ;
}
message = value ;
if ( null != type ) {
message = type ;
}
if ( null == message ) {
message = exception . message ;
}
if ( null == message ) {
let tmp2 ;
if ( "string" === typeof prop1 ) {
if ( prop1 . length > 0 ) {
tmp2 = prop1 ;
}
}
message = tmp2 ;
}
return message ;
}
}
function getErrorStackTrace ( exception ) {
exception = exception . exception ;
let first ;
if ( null != exception ) {
const values = exception . values ;
if ( null != values ) {
first = values [ 0 ] ;
}
}
if ( null == first ) {
const extra2 = exception . extra ;
let prop ;
if ( null != extra2 ) {
prop = extra2 . persisted_error_stack ;
}
let tmp6 ;
if ( "string" === typeof prop ) {
if ( prop . length > 0 ) {
tmp6 = prop ;
}
}
return tmp6 ;
} else {
const stacktrace = first . stacktrace ;
let joined ;
if ( null != stacktrace ) {
const frames = stacktrace . frames ;
if ( null != frames ) {
const mapped = frames . map ( ( filename ) = > "" + filename . filename + ":" + filename . lineno + ":" + filename . colno ) ;
joined = mapped . join ( "\n" ) ;
}
}
if ( null != joined ) {
if ( joined . length > 0 ) {
return joined ;
}
}
const extra = exception . extra ;
let prop1 ;
if ( null != extra ) {
prop1 = extra . persisted_error_stack ;
}
let tmp4 ;
if ( "string" === typeof prop1 ) {
if ( prop1 . length > 0 ) {
tmp4 = prop1 ;
}
}
return tmp4 ;
}
}
function trackCrash ( event , extra , arg2 ) {
let level ;
let flag = arg2 ;
if ( arg2 === undefined ) {
flag = true ;
}
let obj = { event , hint : extra } ;
importDefaultResult . info ( "Crash" , obj ) ;
( { level , extra } = event ) ;
let native_is_native ;
if ( null != extra ) {
native_is_native = extra . native_is_native ;
}
if ( null != native_is_native ) {
let tmp4 = "true" === event . extra . native_is_native ;
} else {
const tags = event . tags ;
let prop ;
if ( null != tags ) {
2026-07-23 10:11:24 +00:00
prop = tags [ "event.origin" ] ;
2026-07-20 16:05:17 +00:00
}
tmp4 = "javascript" !== prop ;
}
if ( "fatal" !== level ) {
return event ;
}
let tmp5 = tmp4 ;
if ( ! tmp4 ) {
tmp5 = "error" !== level ;
}
let num = 1 ;
if ( ! tmp5 ) {
num = 0.01 ;
}
2026-07-23 10:11:24 +00:00
if ( ! c14 ) {
2026-07-20 16:05:17 +00:00
if ( ! sample ( num ) ) {
markCrashHandled ( event . event_id ) ;
}
}
2026-07-23 10:11:24 +00:00
let obj1 = require ( 1198 ) /* shouldNavigate */ ;
2026-07-20 16:05:17 +00:00
let tmp9 = null ;
if ( flag ) {
const event_id = event . event_id ;
tmp9 = null ;
if ( null != event_id ) {
tmp9 = event_id ;
}
}
const timestamp = event . timestamp ;
let result ;
if ( null != timestamp ) {
if ( "number" === typeof timestamp ) {
const _isNaN = isNaN ;
if ( ! isNaN ( timestamp ) ) {
result = 1000 * timestamp ;
}
}
const _Date = Date ;
if ( timestamp instanceof Date ) {
result = timestamp . getTime ( ) ;
} else if ( "string" === tmp11 ) {
const _Date2 = Date ;
const parsed = Date . parse ( timestamp ) ;
const _Number = Number ;
if ( ! Number . isNaN ( parsed ) ) {
result = parsed ;
}
}
}
if ( null == result ) {
const _Date3 = Date ;
result = Date . now ( ) ;
}
2026-07-23 10:11:24 +00:00
const track = importDefault ( 675 ) . track ;
2026-07-20 16:05:17 +00:00
if ( tmp4 ) {
extra = event . extra ;
if ( null == extra ) {
extra = { } ;
}
obj = { did_crash : true , sentry_issue_id : tmp9 , client_track_timestamp : result , exit_reason : getStringExtra ( extra . native_exit_reason ) , exit_description : getStringExtra ( extra . native_exit_description ) , tombstone_hash : getStringExtra ( extra . native_tombstone_hash ) , tombstone_cause : getStringExtra ( extra . native_tombstone_cause ) , tombstone : getStringExtra ( extra . native_tombstone ) , call_stack_tree : getStringExtra ( extra . native_tombstone_group_by ) , binary_name : getStringExtra ( extra . native_tombstone_origin ) , exception_message : getCrashErrorMessage ( event ) , exception_stacktrace : getErrorStackTrace ( event ) , js_error_message : getStringExtra ( extra . persisted_error_message ) , js_error_stacktrace : getStringExtra ( extra . persisted_error_stack ) } ;
track ( tmp17 . APP_NATIVE_CRASH , obj ) ;
} else {
obj = { path : obj1.getHistory ( ) . location . pathname , client_track_timestamp : result , sentry_issue_id : tmp9 , extra , error_message : getCrashErrorMessage ( event ) } ;
let tmp19 ;
if ( null != level ) {
tmp19 = level ;
}
obj . error_level = tmp19 ;
obj . error_stack = getErrorStackTrace ( event ) ;
track ( tmp17 . APP_CRASHED , obj ) ;
}
markCrashHandled ( event . event_id ) ;
2026-07-27 11:26:19 +00:00
const AppCrashedReasons = require ( 13189 ) /* set */ . AppCrashedReasons ;
2026-07-23 10:11:24 +00:00
const tmp16 = importDefault ( 675 ) ;
2026-07-20 16:05:17 +00:00
const tmp27 = tmp4 ? AppCrashedReasons.UNHANDLED_NATIVE_ERROR : AppCrashedReasons.UNHANDLED_JS_ERROR ;
2026-07-25 08:10:48 +00:00
obj1 = { name : require ( 5844 ) /* set */ . MetricEvents . APP_CRASHED } ;
2026-07-20 16:05:17 +00:00
const items = [ "reason:" + tmp27 , ] ;
let str7 = "unknown" ;
if ( null != level ) {
str7 = level ;
}
items [ 1 ] = "level:" + str7 ;
obj1 . tags = items ;
2026-07-25 08:10:48 +00:00
importDefault ( 5839 ) . increment ( obj1 , true ) ;
2026-07-20 16:05:17 +00:00
}
function sample ( arg0 ) {
return Math . random ( ) <= arg0 ;
}
function markCrashHandled ( arg0 ) {
let tmp = "string" === typeof arg0 ;
if ( tmp ) {
tmp = 0 !== arg0 . length ;
}
if ( tmp ) {
2026-07-23 10:11:24 +00:00
importDefault ( 1184 ) . markCrashHandled ( arg0 ) ;
const obj = importDefault ( 1184 ) ;
2026-07-20 16:05:17 +00:00
}
}
function getStringExtra ( native_exit_description ) {
let tmp = null ;
if ( "string" === typeof native_exit_description ) {
tmp = null ;
if ( native_exit_description . length > 0 ) {
tmp = native_exit_description ;
}
}
return tmp ;
}
2026-07-23 10:11:24 +00:00
( { AnalyticEvents : closure_6 , Endpoints } = ME ) ;
addBreadcrumb = addBreadcrumb . reactNavigationIntegration ( ) ;
2026-07-20 16:05:17 +00:00
const regExp = new RegExp ( "/v" + window . GLOBAL_ENV . API_VERSION + Endpoints . METRICS , "g" ) ;
2026-07-23 10:11:24 +00:00
let items = [ regExp , , ] ;
2026-07-20 16:05:17 +00:00
const regExp1 = new RegExp ( "/v" + window . GLOBAL_ENV . API_VERSION + Endpoints . METRICS_V2 , "g" ) ;
items [ 1 ] = regExp1 ;
const regExp2 = new RegExp ( "/v" + window . GLOBAL_ENV . API_VERSION + Endpoints . TRACK , "g" ) ;
items [ 2 ] = regExp2 ;
importDefaultResult = new importDefaultResult ( "Sentry" ) ;
2026-07-23 10:11:24 +00:00
let closure_11 = [ "The operation couldn\u2019t be completed. (com.apple.CallKit.error.requesttransaction" , "Request has been terminated" , "couldn't execute statement: database is disabled" , "couldn't delete database: database is currently open" , "database is no longer open" ] ;
let c12 = 0.05 ;
let c13 = 0.005 ;
let c14 = false ;
let closure_15 = IGNORE_ANALYTICS_BREADCRUMB_EVENTS . filterThrottle ( { maxBudgetMinute : 1 , maxBudgetHour : 15 } ) ;
const result1 = require ( "ME" ) . fileFinishedImporting ( "modules/errors/native/SentryInitUtils.tsx" ) ;
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
export const routingInstrumentation = addBreadcrumb ;
2026-07-20 16:05:17 +00:00
export const initSentry = function initSentry() {
const CrashReportingManager = NativeModules . CrashReportingManager ;
if ( null != CrashReportingManager ) {
const isUserStaffForCrashReporting = CrashReportingManager . getIsUserStaffForCrashReporting ( ( arg0 ) = > {
2026-07-23 10:11:24 +00:00
const outer1_14 = arg0 ;
let obj = outer1_2 ( outer1_3 [ 14 ] ) ;
2026-07-20 16:05:17 +00:00
const constants = obj . getConstants ( ) ;
const ReleaseChannel = constants . ReleaseChannel ;
if ( - 1 === ReleaseChannel . indexOf ( "debug" ) ) {
if ( - 1 === ReleaseChannel . indexOf ( "developer" ) ) {
2026-07-23 10:11:24 +00:00
const isStable = outer1_0 ( outer1_3 [ 15 ] ) . isStable ;
2026-07-20 16:05:17 +00:00
obj = { releaseChannel : ReleaseChannel , isProductionChannel : isStable } ;
2026-07-23 10:11:24 +00:00
outer1_10 . verbose ( "Initialize" , obj ) ;
2026-07-20 16:05:17 +00:00
if ( obj17 . isAndroid ( ) ) {
if ( isStable ) {
2026-07-23 10:11:24 +00:00
let obj1 = outer1_0 ( outer1_3 [ 17 ] ) ;
2026-07-20 16:05:17 +00:00
const device = obj1 . getDevice ( ) ;
}
}
2026-07-23 10:11:24 +00:00
let outer1_12 = 0.05 ;
2026-07-20 16:05:17 +00:00
const SentryDsn = constants . SentryDsn ;
if ( isStable ) {
let SentryStaffDsn = SentryDsn ;
if ( obj3 . isMetaQuest ( ) ) {
2026-07-23 10:11:24 +00:00
outer1_12 = 1 ;
const outer1_13 = 1 ;
2026-07-20 16:05:17 +00:00
SentryStaffDsn = SentryDsn ;
}
2026-07-23 10:11:24 +00:00
obj3 = outer1_0 ( outer1_3 [ 18 ] ) ;
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
outer1_12 = 1 ;
2026-07-20 16:05:17 +00:00
SentryStaffDsn = constants . SentryAlphaBetaDsn ;
}
if ( arg0 ) {
SentryStaffDsn = constants . SentryStaffDsn ;
2026-07-23 10:11:24 +00:00
outer1_12 = 1 ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
( function replayPendingCrashReportIfNeeded() {
const lastCrashReport = outer2_1 ( outer2_3 [ 13 ] ) . getLastCrashReport ( ) ;
let obj = outer2_1 ( outer2_3 [ 13 ] ) ;
2026-07-20 16:05:17 +00:00
lastCrashReport . then ( ( arg0 ) = > {
if ( null != arg0 ) {
const obj = { crash_event_source : "startup_reconcile" } ;
2026-07-23 10:11:24 +00:00
outer3_20 ( arg0 , obj ) ;
2026-07-20 16:05:17 +00:00
}
} ) . catch ( ( arg0 ) = > {
2026-07-23 10:11:24 +00:00
outer3_10 . warn ( "Failed to replay pending crash report" , arg0 ) ;
2026-07-20 16:05:17 +00:00
} ) ;
2026-07-23 10:11:24 +00:00
} ) ( ) ;
obj17 = outer1_0 ( outer1_3 [ 16 ] ) ;
2026-07-20 16:05:17 +00:00
obj = { } ;
2026-07-23 10:11:24 +00:00
const obj4 = outer1_0 ( outer1_3 [ 4 ] ) ;
2026-07-20 16:05:17 +00:00
let str2 = "ios" ;
if ( obj6 . isAndroid ( ) ) {
str2 = "android" ;
}
obj . tunnel = ` /error-reporting-proxy/ ${ str2 } ` ;
obj . autoInitializeNativeSdk = false ;
2026-07-23 10:11:24 +00:00
obj . beforeSend = outer1_17 ;
2026-07-27 11:26:19 +00:00
obj . dist = "6081" ;
2026-07-20 16:05:17 +00:00
obj . dsn = SentryStaffDsn ;
obj . environment = ReleaseChannel ;
obj . tracesSampleRate = 0 ;
obj . sampleRate = 1 ;
2026-07-23 10:11:24 +00:00
obj . ignoreErrors = outer1_11 ;
2026-07-27 11:26:19 +00:00
obj . release = "discord_android@341.0.0-2+341200" ;
2026-07-23 10:11:24 +00:00
const items = [ outer1_7 ] ;
2026-07-20 16:05:17 +00:00
obj . tracePropagationTargets = items ;
2026-07-23 10:11:24 +00:00
const items1 = [ outer1_8 , , ] ;
obj6 = outer1_0 ( outer1_3 [ 16 ] ) ;
items1 [ 1 ] = outer1_0 ( outer1_3 [ 4 ] ) . featureFlagsIntegration ( ) ;
const obj7 = outer1_0 ( outer1_3 [ 4 ] ) ;
2026-07-20 16:05:17 +00:00
obj1 = {
shouldCreateSpanForRequest ( arg0 ) {
2026-07-23 10:11:24 +00:00
return ! outer2_9 . some ( arg0 . match ) ;
2026-07-20 16:05:17 +00:00
}
} ;
2026-07-23 10:11:24 +00:00
items1 [ 2 ] = outer1_0 ( outer1_3 [ 4 ] ) . reactNativeTracingIntegration ( obj1 ) ;
2026-07-20 16:05:17 +00:00
obj . integrations = items1 ;
obj . beforeBreadcrumb = function beforeBreadcrumb ( data ) {
if ( null == data . data ) {
data . data = { } ;
}
2026-07-23 10:11:24 +00:00
const currentMemoryUsageKB = outer2_1 ( outer2_3 [ 19 ] ) . getCurrentMemoryUsageKB ( ) ;
2026-07-20 16:05:17 +00:00
if ( null != currentMemoryUsageKB ) {
data . data . client_performance_memory = currentMemoryUsageKB ;
}
2026-07-23 10:11:24 +00:00
const obj = outer2_1 ( outer2_3 [ 19 ] ) ;
const currentCPUUsagePercent = outer2_1 ( outer2_3 [ 19 ] ) . getCurrentCPUUsagePercent ( ) ;
2026-07-20 16:05:17 +00:00
if ( null != currentCPUUsagePercent ) {
data . data . client_performance_cpu = currentCPUUsagePercent ;
}
return data ;
} ;
obj4 . init ( obj ) ;
2026-07-23 10:11:24 +00:00
const obj8 = outer1_0 ( outer1_3 [ 4 ] ) ;
2026-07-27 11:26:19 +00:00
outer1_0 ( outer1_3 [ 4 ] ) . setTag ( "buildNumber" , "6081" ) ;
2026-07-23 10:11:24 +00:00
const obj10 = outer1_0 ( outer1_3 [ 4 ] ) ;
outer1_0 ( outer1_3 [ 4 ] ) . setTag ( "appVersion" , constants . Version ) ;
const obj11 = outer1_0 ( outer1_3 [ 4 ] ) ;
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal ;
2026-07-23 10:11:24 +00:00
outer1_0 ( outer1_3 [ 4 ] ) . setTag ( "design_id" , "" + outer1_0 ( outer1_3 [ 20 ] ) . DesignIds . DESIGN_TABS_IA ) ;
const obj12 = outer1_0 ( outer1_3 [ 4 ] ) ;
const obj13 = outer1_0 ( outer1_3 [ 4 ] ) ;
obj13 . setTag ( "newArchEnabled" , outer1_0 ( outer1_3 [ 21 ] ) . isFabric ( ) ) ;
const obj14 = outer1_0 ( outer1_3 [ 21 ] ) ;
outer1_0 ( outer1_3 [ 4 ] ) . setTag ( "isBridgeless" , outer1_0 ( outer1_3 [ 21 ] ) . isBridgeless ) ;
const obj15 = outer1_0 ( outer1_3 [ 4 ] ) ;
2026-07-20 16:05:17 +00:00
}
}
} ) ;
}
} ;