Error variable not being set for error callback

Hi.
NOt sure if this is the right place for this question, so apologies if I am in the wrong place. I have a Raisl 6 application and am using Stimulus Reflex. Recently I tried to utilize the error callback by raising an error in the Rails reflex. I then added a reflexError callback for my specific reflex in the javascript controller.

def my_reflex
  raise "custom error"
end

// In JS controller
myReflexError(element, reflex, error){...}

However, the error parameter is always undefined. The docs suggest that the raised error should be passed to the callback. Wondering if anyone has seen similar behaviour or have I completely misunderstood the docs.

Thanks in advance.