Skip to content

fetchUpdate assumes import error to be instanceof Error #19709

Open
@jiftoo

Description

@jiftoo

Describe the bug

Title. This is problematic when it comes to debugging top level exceptions, as one would see TypeError: err.message is undefined instead of the actual error if the module throws an object that doesn't have a message: string property defined.

Relevant code:

Reproduction

https://stackblitz.com/edit/vitejs-vite-9ucejjv8?file=src%2FApp.jsx

Steps to reproduce

  1. Launch the app
  2. Wait for 'ok' to show up
  3. Uncomment throw 'error'; in App.jsx
  4. Check console

Current:

> Uncaught (in promise) TypeError: err.message is undefined
    warnFailedUpdate client:163
    ...

Expected:

> [vite] error
> [vite] Failed to reload /src/App.jsx. This could be due to syntax errors or importing non-existent modules. (see errors above)

System Info

System:
  OS: Linux 5.0 undefined
  CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Memory: 0 Bytes / 0 Bytes
  Shell: 1.0 - /bin/jsh
Binaries:
  Node: 18.20.3 - /usr/local/bin/node
  Yarn: 1.22.19 - /usr/local/bin/yarn
  npm: 10.2.3 - /usr/local/bin/npm
  pnpm: 8.15.6 - /usr/local/bin/pnpm
npmPackages:
  @vitejs/plugin-react: ^4.3.4 => 4.3.4 
  vite: ^6.2.2 => 6.2.2

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions