enhancementhelp wanted
Description
errorSelector currently takes a custom message as a parameter and passes that message into a newly constructed Error object.
Current: errorSelector("This is my error message")
I believe that asking for an Error object as the argument instead of a message would allow for greater control and flexibility.
Proposed: errorSelector(new Error("This is my error message"))
Proposed:
errorSelector(() => {
let e = new Error();
e.name = "AuthError";
e.message = "User is not logged in";
return e;
})
If this is functionality that we would like to see in Recoil, I would love to submit a PR on this.