MCPcopy
hub / github.com/didi/mpx / error

Function error

packages/utils/src/log.js:31–55  ·  view source on GitHub ↗
(msg, location, e)

Source from the content-addressed store, hash-verified

29}
30
31export function error (msg, location, e) {
32 const workInProgress = global.workInProgress
33 let stack = ''
34 if (workInProgress) {
35 stack = getStackByFiberInDevAndProd(workInProgress)
36 }
37 const errorHandler = mpxGlobal.__mpx?.config.errorHandler
38 if (!e) {
39 e = new Error(stack ? `${msg}\n Error Component Stack:${stack}` : msg)
40 } else {
41 if (stack) {
42 if (type(e) === 'Error') {
43 e.message += `\n Error Component Stack:${stack}`
44 }
45 if (type(e) === 'String') {
46 e += `\n Error Component Stack:${stack}`
47 }
48 }
49 }
50 if (isFunction(errorHandler)) {
51 errorHandler(msg, location, e)
52 } else {
53 log('error', msg, location, e)
54 }
55}
56
57function log (type, msg, location, e) {
58 if (isDev) {

Callers 15

handleErrorFunction · 0.90
extendPropsFunction · 0.90
initSetupMethod · 0.90
doRenderMethod · 0.90
initRenderMethod · 0.90
extractMixinsFunction · 0.90
convertErrorDescFunction · 0.90
convertErrorDescFunction · 0.90
convertErrorDescFunction · 0.90
convertErrorDescFunction · 0.90
convertFunction · 0.90

Calls 4

typeFunction · 0.90
isFunctionFunction · 0.90
logFunction · 0.85

Tested by

no test coverage detected