solid icon indicating copy to clipboard operation
solid copied to clipboard

`createResource` does not catch falsy errors

Open otonashixav opened this issue 3 years ago • 1 comments

Describe the bug

Like #1007, createResource also does not correctly handle falsy errors.

Your Example Website or App

https://playground.solidjs.com/?hash=-1153565294&version=1.4.1

Steps to Reproduce the Bug or Issue

Expected behavior

Falsy errors should still be errors.

Screenshots or Videos

No response

Platform

  • OS: Windows 10 21H1
  • Browser: Firefox
  • Version: 100.0.2

Additional context

FWIW #945 can be implemented in a non-breaking way if resource.error is always a truthy type when there is an error (e.g. by wrapping non-errors in errors).

otonashixav avatar May 29 '22 05:05 otonashixav

Dealing with undefined errors is a mess. And incredibly error prone since it involves proxying a placeholder around. We are going to take a different path. We will cast undefined and falsy errors to Errors and leave it like that. After going down a rabbit hole this is just not worth trying to make work. createResource will be handled the same.

ryansolid avatar Aug 01 '22 04:08 ryansolid