dianping/cat · error · Error

Provided callback for onbeforechange was not a function

Error message

Provided callback for onbeforechange was not a function

What it means

Error "Provided callback for onbeforechange was not a function" thrown in dianping/cat.

Source

Thrown at cat-home/src/main/webapp/js/intro.js:1223

    },
    previousStep: function() {
      _previousStep.call(this);
      return this;
    },
    exit: function() {
      _exitIntro.call(this, this._targetElement);
      return this;
    },
    refresh: function() {
      _setHelperLayerPosition.call(this, document.querySelector('.introjs-helperLayer'));
      _setHelperLayerPosition.call(this, document.querySelector('.introjs-tooltipReferenceLayer'));
      return this;
    },
    onbeforechange: function(providedCallback) {
      if (typeof (providedCallback) === 'function') {
        this._introBeforeChangeCallback = providedCallback;
      } else {
        throw new Error('Provided callback for onbeforechange was not a function');
      }
      return this;
    },
    onchange: function(providedCallback) {
      if (typeof (providedCallback) === 'function') {
        this._introChangeCallback = providedCallback;
      } else {
        throw new Error('Provided callback for onchange was not a function.');
      }
      return this;
    },
    onafterchange: function(providedCallback) {
      if (typeof (providedCallback) === 'function') {
        this._introAfterChangeCallback = providedCallback;
      } else {
        throw new Error('Provided callback for onafterchange was not a function');
      }
      return this;

View on GitHub (pinned to e815e74d4c)

Solutions

  1. Pass a function to setOnBeforeChange or omit the callback.
  2. Check for a typo that passes a non-function value such as undefined.

When it happens

Trigger: Triggered when onbeforechange is assigned a non-function value (e.g. undefined result, string, or object) instead of a callback function.

Common situations: See trigger scenarios.


AI-assisted analysis of dianping/cat@e815e74d4c (2026-08-14). Data as JSON: /api/errors/52f36e24cfc30873. Report an issue: GitHub.