Open cedrick-ah opened 1 week ago
In that example, if adding return
fixes things, then i'm not sure why you wouldn't just add it. Is there a reason why you wouldn't?
This is not me. Anyone would pass by inattention this kind of action. I thought this would be more appropriate to report this way than just leaving an error uncaught.
Node.js Version:
v18.20.4
Operating System:
Debian 5.10.226-1 (2024-10-03) x86_64 GNU/Linux
Steps to Produce Error:
When provided a function that does not return a promise to the circuit breaker:
Instead of a valid asynchronous function:
Result:
The problem
Opossum is a Node.js circuit breaker that executes asynchronous functions and monitors their execution status. When it happens that the function provided to Opossum does not meet the conditions of an asynchronous function or that the execution result cannot be obtained, this type of error occurs. To fix this, we can check if the result of executing the asynchronous method exists.
The fix
Simple fix would be to check if the result of the call of the provided action is not
undefined
: