-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
Milestone
Description
Describe the bug
When you use instanceof
on an ActionFailure
class, it fails with a TypeError: Right-hand side of 'instanceof' is not an object
.
Reproduction
https://gitlab.com/Curstantine/sveltekit-instanceof-runtime
Logs
TypeError: Right-hand side of 'instanceof' is not an object
at default (/home/<REDACTED>/Code/Experimental/sveltekit-instanceof-runtime/src/routes/+page.server.js:15:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Module.handle_action_json_request (/home/<REDACTED>/Code/Experimental/sveltekit-instanceof-runtime/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/runtime/server/page/actions.js:57:16)
at async resolve (/home/<REDACTED>/Code/Experimental/sveltekit-instanceof-runtime/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/runtime/server/respond.js:412:18)
at async Module.respond (/home/<REDACTED>/Code/Experimental/sveltekit-instanceof-runtime/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/runtime/server/respond.js:279:20)
at async file:///home/<REDACTED>/Code/Experimental/sveltekit-instanceof-runtime/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:505:22
System Info
System:
OS: Linux 6.4 Arch Linux
CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
Memory: 1.95 GB / 7.65 GB
Container: Yes
Shell: 3.6.1 - /bin/fish
Binaries:
Node: 20.4.0 - /usr/bin/node
Yarn: 1.22.19 - /usr/bin/yarn
npm: 9.8.0 - /usr/bin/npm
pnpm: 8.6.6 - /usr/bin/pnpm
npmPackages:
@sveltejs/adapter-auto: ^2.0.0 => 2.1.0
@sveltejs/kit: ^1.20.4 => 1.22.1
svelte: ^4.0.0 => 4.0.5
vite: ^4.3.6 => 4.4.2
Severity
annoyance
Additional Information
This is most likely due to this "grotesque" hack not working.
This is apparent when you directly call an ActionFailure
.
e.g.
import { ActionFailure } from "@sveltejs/kit";
const x = new ActionFailure(422, { message: "Deformed request" })`; // fails here
console.debug(x instanceof ActionFailure);
FoHoOV