Don’t you need to load the current user session first so you have access to the User record? I think the first parameter to getCurrentUser is an object with a single key (id or whatever the primary key of your User model is).
Don’t you need to load the current user session first so you have access to the User record?
The problem isn’t with the user access, that part is working fine. The problem is that when I check email_verified and it’s false I want to throw an error that I can catch in the browser and determine that it was an unverified user. I’ve tried throwing AuthenticationError as well as RedwoodError but each one just gives me the “something went wrong” error which isn’t very helpful
This is the file that converts Redwood errors to Yoga errors. If you’re using VS Code, you should get debugger configuration already set up for you. You might try setting a breakpoint inside the useRedwoodError.ts file in your node_modules and see if there’s any useful information available there to troubleshoot.
I’m wondering if useRedwoodAuthContext should not throw a new error but rather use the AuthenticationError I’m throwing? I’m not sure it would make a difference. I’m not sure how Redwood determines not to mask an error.
I think the actual error masking is taking place within Yoga (their docs on it here). The reason for the useRedwoodError.ts file I linked (from the notes in the file) is to convert to a Redwood exception class to one that Yoga will recognize as over-riding its built-in error masking behavior (since Yoga doesn’t allow custom exception classes).
I think you’re right, the problem seems to be in useRedwoodAuthContext.ts - the fact that the AuthenticationError import is commented out is suspicious. You should probably open an issue on the repo; I’m not sure what the history is on it.