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

Function callWithAsyncErrorHandling

packages/runtime-core/src/errorHandling.ts:83–110  ·  view source on GitHub ↗
(
  fn: Function | Function[],
  instance: ComponentInternalInstance | null,
  type: ErrorTypes,
  args?: unknown[],
)

Source from the content-addressed store, hash-verified

81}
82
83export function callWithAsyncErrorHandling(
84 fn: Function | Function[],
85 instance: ComponentInternalInstance | null,
86 type: ErrorTypes,
87 args?: unknown[],
88): any {
89 if (isFunction(fn)) {
90 const res = callWithErrorHandling(fn, instance, type, args)
91 if (res && isPromise(res)) {
92 res.catch(err => {
93 handleError(err, instance, type)
94 })
95 }
96 return res
97 }
98
99 if (isArray(fn)) {
100 const values = []
101 for (let i = 0; i < fn.length; i++) {
102 values.push(callWithAsyncErrorHandling(fn[i], instance, type, args))
103 }
104 return values
105 } else if (__DEV__) {
106 warn(
107 `Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`,
108 )
109 }
110}
111
112export function handleError(
113 err: unknown,

Callers 10

invokerFunction · 0.90
callHookFunction · 0.90
unmountFunction · 0.90
emitFunction · 0.90
injectHookFunction · 0.90
doWatchFunction · 0.90
invokeVNodeHookFunction · 0.90
invokeDirectiveHookFunction · 0.90
callHookFunction · 0.90
emitFunction · 0.90

Calls 6

isFunctionFunction · 0.90
isPromiseFunction · 0.90
warnFunction · 0.90
callWithErrorHandlingFunction · 0.85
handleErrorFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected