Home > widget-integration > FilterController > runNonCritical

FilterController.runNonCritical() method

Runs an initialization step that must not be able to abort the rest of init().

init() is a straight sequence, so an exception in any step silently skips every step after it. Steps that only persist state, wire up analytics, or bridge legacy modules are wrapped here: losing them degrades a convenience, whereas losing the steps that follow leaves shoppers with an empty, unclickable filter tree.

Signature:

protected runNonCritical(step: string, run: () => void): void;

Parameters

Parameter

Type

Description

step

string

Name of the step, used when reporting a failure

run

() => void

The step to execute

Returns:

void

Example

Report initialization failures to a shop's own monitoring:

runNonCritical(step, run) {
  try {
    super.runNonCritical(step, run);
  } finally {
    window.myMonitoring?.mark(`boost-filter-${step}`);
  }
}