error.ts — vue Source File
Architecture documentation for error.ts, a typescript file in the vue codebase. 8 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR 34ce4c45_a0c3_08f3_7cbe_679778705432["error.ts"] d22f3dff_cc24_705a_1193_eec206dcb1d5["config.ts"] 34ce4c45_a0c3_08f3_7cbe_679778705432 --> d22f3dff_cc24_705a_1193_eec206dcb1d5 c11cafd0_9de7_a29e_a7df_dc098f20ea24["debug.ts"] 34ce4c45_a0c3_08f3_7cbe_679778705432 --> c11cafd0_9de7_a29e_a7df_dc098f20ea24 e8b22500_20a5_2e19_4c79_386004841499["warn"] 34ce4c45_a0c3_08f3_7cbe_679778705432 --> e8b22500_20a5_2e19_4c79_386004841499 193753e6_b34c_6e61_7eaf_22084e4e0013["env.ts"] 34ce4c45_a0c3_08f3_7cbe_679778705432 --> 193753e6_b34c_6e61_7eaf_22084e4e0013 dfb2b3e1_ffba_6029_124e_b43a30f0f999["dep.ts"] 34ce4c45_a0c3_08f3_7cbe_679778705432 --> dfb2b3e1_ffba_6029_124e_b43a30f0f999 46145e02_0be2_a179_3c66_d786e8df82f3["pushTarget"] 34ce4c45_a0c3_08f3_7cbe_679778705432 --> 46145e02_0be2_a179_3c66_d786e8df82f3 f641f94c_5096_9084_3285_10f3d148c139["popTarget"] 34ce4c45_a0c3_08f3_7cbe_679778705432 --> f641f94c_5096_9084_3285_10f3d148c139 156bf2e1_8a13_f22d_5437_54f14bcef8fa["util"] 34ce4c45_a0c3_08f3_7cbe_679778705432 --> 156bf2e1_8a13_f22d_5437_54f14bcef8fa 6a3cc423_2c8d_a3ad_7c16_364ff040a3cb["next-tick.ts"] 6a3cc423_2c8d_a3ad_7c16_364ff040a3cb --> 34ce4c45_a0c3_08f3_7cbe_679778705432 style 34ce4c45_a0c3_08f3_7cbe_679778705432 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import config from '../config'
import { warn } from './debug'
import { inBrowser } from './env'
import { isPromise } from 'shared/util'
import { pushTarget, popTarget } from '../observer/dep'
export function handleError(err: Error, vm: any, info: string) {
// Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
// See: https://github.com/vuejs/vuex/issues/1505
pushTarget()
try {
if (vm) {
let cur = vm
while ((cur = cur.$parent)) {
const hooks = cur.$options.errorCaptured
if (hooks) {
for (let i = 0; i < hooks.length; i++) {
try {
const capture = hooks[i].call(cur, err, vm, info) === false
if (capture) return
} catch (e: any) {
globalHandleError(e, cur, 'errorCaptured hook')
}
}
}
}
}
globalHandleError(err, vm, info)
} finally {
popTarget()
}
}
export function invokeWithErrorHandling(
handler: Function,
context: any,
args: null | any[],
vm: any,
info: string
) {
let res
try {
res = args ? handler.apply(context, args) : handler.call(context)
if (res && !res._isVue && isPromise(res) && !(res as any)._handled) {
res.catch(e => handleError(e, vm, info + ` (Promise/async)`))
// issue #9511
// avoid catch triggering multiple times when nested calls
;(res as any)._handled = true
}
} catch (e: any) {
handleError(e, vm, info)
}
return res
}
function globalHandleError(err, vm, info) {
if (config.errorHandler) {
try {
return config.errorHandler.call(null, err, vm, info)
} catch (e: any) {
// if the user intentionally throws the original error in the handler,
// do not log it twice
if (e !== err) {
logError(e, null, 'config.errorHandler')
}
}
}
logError(err, vm, info)
}
function logError(err, vm, info) {
if (__DEV__) {
warn(`Error in ${info}: "${err.toString()}"`, vm)
}
/* istanbul ignore else */
if (inBrowser && typeof console !== 'undefined') {
console.error(err)
} else {
throw err
}
}
Domain
Subdomains
Imported By
Source
Frequently Asked Questions
What does error.ts do?
error.ts is a source file in the vue codebase, written in typescript. It belongs to the CompilerSFC domain, StyleProcessor subdomain.
What functions are defined in error.ts?
error.ts defines 4 function(s): globalHandleError, handleError, invokeWithErrorHandling, logError.
What does error.ts depend on?
error.ts imports 8 module(s): config.ts, debug.ts, dep.ts, env.ts, popTarget, pushTarget, util, warn.
What files import error.ts?
error.ts is imported by 1 file(s): next-tick.ts.
Where is error.ts in the architecture?
error.ts is located at src/core/util/error.ts (domain: CompilerSFC, subdomain: StyleProcessor, directory: src/core/util).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free