Firebot icon indicating copy to clipboard operation
Firebot copied to clipboard

Add more detailed logging to effect-helper.service.js

Open TheStaticMage opened this issue 1 month ago • 0 comments

Describe the solution you'd like

I already committed this in my personal fork. If you dev-approve this, I'll submit it as a proper PR.

I would like to add a try/catch with a better error message to effect-helper.service.js.

Like:

const mapEffectDef = function(effectDef) {
  try {
    return {
      // ...
    }
  } catch (err) {
    throw new Error(`Error mapping effect definition for "${effectDef.definition.id}": ${err.message}`);
  }
};

Additional context

I started experiencing all of my effect lists being empty with a recent v5 pull, and this in the logs:

[2025-11-19 21:49:56.100] [DEBUG] got get all effects request
[2025-11-19 21:49:56.189] [ERROR] [Renderer] Unexpected token '{'
SyntaxError: Unexpected token '{'
    at mapEffectDef (file:///home/XXX/Firebot/build/gui/app/services/effect-helper.service.js:13:51)
    at Array.map (<anonymous>)
    at service.getAllEffectTypes (file:///home/XXX/Firebot/build/gui/app/services/effect-helper.service.js:35:61)

This was ultimately due to one of my custom scripts defining an effect with a syntax error. It became very easy to track down when the error message actually included the name of the effect. Re-throwing the error also gets this into the Firebot log (❤️ for that enhancement).

[2025-11-19 21:49:56.189] [ERROR] [Renderer] Error mapping effect definition for "my-custom-script:broken-effect": Unexpected token '{'
SyntaxError: Unexpected token '{'
    at mapEffectDef (file:///home/XXX/Firebot/build/gui/app/services/effect-helper.service.js:13:51)
    at Array.map (<anonymous>)
    at service.getAllEffectTypes (file:///home/XXX/Firebot/build/gui/app/services/effect-helper.service.js:35:61)

TheStaticMage avatar Nov 20 '25 04:11 TheStaticMage