MCPcopy Create free account
hub / github.com/effector/effector / printErrorWithNodeDetails

Function printErrorWithNodeDetails

src/effector/throw.ts:26–54  ·  view source on GitHub ↗
(message: string, node: Node)

Source from the content-addressed store, hash-verified

24 )
25
26export const printErrorWithNodeDetails = (message: string, node: Node) => {
27 const stack = getMeta(node, 'unitTrace')
28 const config = getMeta(node, 'config')
29 const locString = config?.loc
30 ? ` at ${config.loc.file}`
31 : null
32 const name = config?.name
33
34 let finalMessage = message
35 if (name) {
36 finalMessage = `${name}: ${message}`
37 }
38 if (locString) {
39 finalMessage = `${name}${locString}: ${message}`
40 }
41
42 const error = Error(finalMessage)
43
44 if (stack) {
45 error.stack = stack
46 }
47
48 if (!stack && !name && !locString) {
49 console.log(
50 `Add effector's Babel or SWC plugin to your config for more detailed debug information or "import "effector/enable_debug_traces" to your code entry module to see full stack traces`,
51 )
52 }
53 console.error(error)
54}

Callers 2

createStoreFunction · 0.90
serializeFunction · 0.90

Calls 1

getMetaFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…