MCPcopy
hub / github.com/vuejs/core / logError

Function logError

packages/runtime-core/src/errorHandling.ts:157–185  ·  view source on GitHub ↗
(
  err: unknown,
  type: ErrorTypes,
  contextVNode: VNode | null,
  throwInDev = true,
  throwInProd = false,
)

Source from the content-addressed store, hash-verified

155}
156
157function logError(
158 err: unknown,
159 type: ErrorTypes,
160 contextVNode: VNode | null,
161 throwInDev = true,
162 throwInProd = false,
163) {
164 if (__DEV__) {
165 const info = ErrorTypeStrings[type]
166 if (contextVNode) {
167 pushWarningContext(contextVNode)
168 }
169 warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`)
170 if (contextVNode) {
171 popWarningContext()
172 }
173 // crash in dev by default so it's more noticeable
174 if (throwInDev) {
175 throw err
176 } else if (!__TEST__) {
177 console.error(err)
178 }
179 } else if (throwInProd) {
180 throw err
181 } else {
182 // recover in prod to reduce the impact on end-user
183 console.error(err)
184 }
185}

Callers 1

handleErrorFunction · 0.85

Calls 4

pushWarningContextFunction · 0.90
warnFunction · 0.90
popWarningContextFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected