The castError
behavior of createResource
should be documented
#825
Labels
castError
behavior of createResource
should be documented
#825
Describe the bug
https://github.com/solidjs/solid-docs/blob/883f25e17843fff81d002a80e8f9a3344556fdaf/langs/en/api/api.md?plain=1#L403
The documentation linked above says
The second part is not true. There is a
castError
function that's called which modifies the error thrown by the fetcher, making sure thatdata.error
is always anError
object, and thereforedata.error
is not always what the fetcher throws:https://github.com/solidjs/solid/blob/1afe035c80f0dc2815951e648e9fa4e8cc5e6054/packages/solid/src/reactive/signal.ts#L1687-L1690
If what the fetcher throws is a string, it becomes
data.error.message
. If it's neither a string nor anError
, it becomesdata.error.cause
.I haven't found documentation for this and had to look at the code, but I think this is definitely something that should appear in the documentation.
Your Example Website or App
N/A
Steps to Reproduce the Bug or Issue
N/A
Expected behavior
The documentation of
createResource
(and maybe other places where thecastError
is used) should mention the behavior.Screenshots or Videos
No response
Platform
All
Additional context
No response
The text was updated successfully, but these errors were encountered: