SolidJSS
SolidJSโ€ข3y agoโ€ข
11 replies
Mathieu

createResource swallows error?

I noticed errors get swallowed when I use createResource. Here is some simplified example code:
window.addEventListener('unhandledrejection', (e) => console.error(e));
window.addEventListener('error', (e) => console.error(e));

function getCurrentUserResource() {
  const [userData] =
    createResource<any>(
      async () => {
        console.log('hello!') // logs
        throw 'error'; // swallowed
      }
    );
  return userData;
}

getCurrentUserResource();

The error is not logged in the console
Was this page helpful?