vue3-core/packages/core/src/errorHandling.ts

27 lines
496 B
TypeScript
Raw Normal View History

2018-09-19 23:35:38 +08:00
import { MountedComponent } from './component'
export const enum ErrorTypes {
LIFECYCLE = 1,
2018-09-24 08:30:26 +08:00
RENDER,
RENDER_ERROR,
NATIVE_EVENT_HANDLER,
COMPONENT_EVENT_HANDLER
2018-09-19 23:35:38 +08:00
}
const globalHandlers: Function[] = []
export function globalHandleError(handler: () => void) {
globalHandlers.push(handler)
return () => {
globalHandlers.splice(globalHandlers.indexOf(handler), 1)
}
}
export function handleError(
err: Error,
instance: MountedComponent,
2018-09-24 08:30:26 +08:00
type: ErrorTypes
2018-09-19 23:35:38 +08:00
) {
// TODO
}