recordStartupCrash method

void recordStartupCrash()

Manually or automatically record an unhandled startup crash.

Implementation

void recordStartupCrash() {
  if (_isHealthy || _activePatchId == null) return;

  final patchId = _activePatchId!;
  _healthTimer?.cancel();
  final newCount = storage.getConsecutiveCrashes(patchId) + 1;
  storage.setConsecutiveCrashes(patchId, newCount);

  logger.error('Watchdog: Startup crash recorded for patch "$patchId" (Count: $newCount/$maxCrashThreshold)');

  if (newCount >= maxCrashThreshold) {
    _triggerSelfHealingRollback(patchId, 'Exceeded $maxCrashThreshold consecutive crashes during launch');
  }
}