() => {
'worklet';
// some logic
}
function () {
'worklet'
// some logic
}
Those functions are named anonymous and parsed as such on the Worklet Runtime. However, this is a pitfall for Reanimated. When the anonymous function crashes and the stack trace is vague - it usually is, especially in production - the first suspicion is the error in Reanimated's core logic, since we don't know which function in particular has failed.
In case of a faulty logic in a third-party library this is double as harmful. It doesn't lead the creators of these libraries into the pit of success, since they might not be aware it's their code causing issues. Conversely, Reanimated maintainers receive a very obscure issue and engage in rather unpleasant debugging process - only to discover later the library's fault.
Test plan
[ ] Update the plugin test snapshots.
[ ] Add relevant test cases if not present already.
[ ] Try to recreate a crash for a third party library, compare the clarity of raised exceptions.
Summary
Currently, in case of unnamed worklets, such as
Those functions are named
anonymous
and parsed as such on the Worklet Runtime. However, this is a pitfall for Reanimated. When theanonymous
function crashes and the stack trace is vague - it usually is, especially in production - the first suspicion is the error in Reanimated's core logic, since we don't know which function in particular has failed.In case of a faulty logic in a third-party library this is double as harmful. It doesn't lead the creators of these libraries into the pit of success, since they might not be aware it's their code causing issues. Conversely, Reanimated maintainers receive a very obscure issue and engage in rather unpleasant debugging process - only to discover later the library's fault.
Test plan