"Expected an error object to be thrown." At From 0 to Production - The Modern React Tutorial

Hi, I was watching Theo's "From 0 to Production - The Modern React Tutorial (RSCs, Next.js, Shadui, Drizzle, TS and more)" and at 55:35, he was implementing UploadThing to the app and I had an error at if (!user.userId) throw new UploadThingError("Unauthorized"); and I couldn't fix it. I am using VSCode's ESLint Plugin and it gave me this error. "Expected an error object to be thrown." I have no idea how to fix it. Can anyone help me? Thanks a lot!
No description
4 Replies
test_1
test_15mo ago
I have the same issue
MUG Knight
MUG Knight4mo ago
Same issue. I assumed UploadThingError extends an Error object, but that appears to be inocrrect. The "simple" solution is to just throw a regular Error object.
bakdaddy
bakdaddy4mo ago
I'm not really familair with the tutorial (yet) but you could try to pass "as Error" at the end of the line 17
Bryson
Bryson4w ago
i had the same issue and tried tinkering with .eslintrc.cjs to fix it, but honestly i think restarting vscode was what fixed it for me?

Did you find this page helpful?