Home / Function/ prepareError() — vite Function Reference

prepareError() — vite Function Reference

Architecture documentation for the prepareError() function in error.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  350125bb_754e_f5e3_28c9_3c404a3e4edb["prepareError()"]
  09588b79_e65d_f18b_cb8c_e85991fbc94c["error.ts"]
  350125bb_754e_f5e3_28c9_3c404a3e4edb -->|defined in| 09588b79_e65d_f18b_cb8c_e85991fbc94c
  848ddbbd_3d45_b055_e84a_874b4ca3fd45["listen()"]
  848ddbbd_3d45_b055_e84a_874b4ca3fd45 -->|calls| 350125bb_754e_f5e3_28c9_3c404a3e4edb
  55a72845_539c_1cc5_148b_2c87bf18e4db["invalidateModule()"]
  55a72845_539c_1cc5_148b_2c87bf18e4db -->|calls| 350125bb_754e_f5e3_28c9_3c404a3e4edb
  8f73b680_d5b9_383c_f695_c906b80fb1e6["handleHMRUpdate()"]
  8f73b680_d5b9_383c_f695_c906b80fb1e6 -->|calls| 350125bb_754e_f5e3_28c9_3c404a3e4edb
  06e41939_9aa1_da0d_2605_8da225bc1ae5["logError()"]
  06e41939_9aa1_da0d_2605_8da225bc1ae5 -->|calls| 350125bb_754e_f5e3_28c9_3c404a3e4edb
  247ba70b_7493_fcc6_f469_b822243eb8f1["errorMiddleware()"]
  247ba70b_7493_fcc6_f469_b822243eb8f1 -->|calls| 350125bb_754e_f5e3_28c9_3c404a3e4edb
  93eb1731_02de_7e6d_e47f_2b65d8a3e93d["cleanStack()"]
  350125bb_754e_f5e3_28c9_3c404a3e4edb -->|calls| 93eb1731_02de_7e6d_e47f_2b65d8a3e93d
  style 350125bb_754e_f5e3_28c9_3c404a3e4edb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/server/middlewares/error.ts lines 11–23

export function prepareError(err: Error | RollupError): ErrorPayload['err'] {
  // only copy the information we need and avoid serializing unnecessary
  // properties, since some errors may attach full objects (e.g. PostCSS)
  return {
    message: strip(err.message),
    stack: strip(cleanStack(err.stack || '')),
    id: (err as RollupError).id,
    frame: strip((err as RollupError).frame || ''),
    plugin: (err as RollupError).plugin,
    pluginCode: (err as RollupError).pluginCode?.toString(),
    loc: (err as RollupError).loc,
  }
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does prepareError() do?
prepareError() is a function in the vite codebase, defined in packages/vite/src/node/server/middlewares/error.ts.
Where is prepareError() defined?
prepareError() is defined in packages/vite/src/node/server/middlewares/error.ts at line 11.
What does prepareError() call?
prepareError() calls 1 function(s): cleanStack.
What calls prepareError()?
prepareError() is called by 5 function(s): errorMiddleware, handleHMRUpdate, invalidateModule, listen, logError.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free