Replies: 1 comment
-
I endorse this message!! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If a bound function returns an error, I believe currently the error consists only of an error string. At least, that's what I've seen so far.
I wonder if it would be useful to make errors a struct (kind of like those with
fetch
calls, where you get all sorts of info about an error like the response status, headers, etc) -- containing the error string of course, but perhaps also the name of the error type, and perhaps common known errors, like exported errors in the Go std lib, since the frontend can't type-assert errors AFAIK. (For example,errors.Is(err, fs.ErrNotExist)
, etc, and similar errors inos
ornet
).For now, as a workaround I'm just manually detecting the errors I'm interested in (in my case,
fs.ErrNotExist
) and adding a keyword to the error string (fmt.Errorf("%w (ErrNotExist)"
) then I can useerror.includes("ErrNotExist")
on the front-end to detect that kind of error.Just wondering what everyone's thoughts are on something like this. 😃 Depending on availability and difficulty I could potentially submit a patch!
Beta Was this translation helpful? Give feedback.
All reactions