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 88dc54e4_4a50_ce50_5fb5_52118613323e["error.ts"] 81a11719_3457_ecad_7c86_c586d804debb["config.ts"] 88dc54e4_4a50_ce50_5fb5_52118613323e --> 81a11719_3457_ecad_7c86_c586d804debb 4be43750_5259_d6e1_902d_9b3e2df2b9c4["debug.ts"] 88dc54e4_4a50_ce50_5fb5_52118613323e --> 4be43750_5259_d6e1_902d_9b3e2df2b9c4 48bc61b1_05ca_3121_50a7_2f02cdcf2f03["warn"] 88dc54e4_4a50_ce50_5fb5_52118613323e --> 48bc61b1_05ca_3121_50a7_2f02cdcf2f03 aa2b6238_64b5_d2a0_65ca_67fd6aa3bf04["env.ts"] 88dc54e4_4a50_ce50_5fb5_52118613323e --> aa2b6238_64b5_d2a0_65ca_67fd6aa3bf04 e5c4d6ab_2495_a6d4_d962_9d9f71bf3114["dep.ts"] 88dc54e4_4a50_ce50_5fb5_52118613323e --> e5c4d6ab_2495_a6d4_d962_9d9f71bf3114 d9fae33f_7845_7289_de16_bee11c7f60e1["pushTarget"] 88dc54e4_4a50_ce50_5fb5_52118613323e --> d9fae33f_7845_7289_de16_bee11c7f60e1 e4823f37_5db2_5310_aa9c_5b3593b02b07["popTarget"] 88dc54e4_4a50_ce50_5fb5_52118613323e --> e4823f37_5db2_5310_aa9c_5b3593b02b07 09aa5370_2caa_6b33_3f44_6ac5211bd11b["util"] 88dc54e4_4a50_ce50_5fb5_52118613323e --> 09aa5370_2caa_6b33_3f44_6ac5211bd11b bf792703_842a_50eb_c357_a2c1c61e235e["next-tick.ts"] bf792703_842a_50eb_c357_a2c1c61e235e --> 88dc54e4_4a50_ce50_5fb5_52118613323e style 88dc54e4_4a50_ce50_5fb5_52118613323e 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 VueCore domain, GlobalAPI 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: VueCore, subdomain: GlobalAPI, directory: src/core/util).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free