const bindCache = new WeakMap()
+// TODO: bound methods should also capture/handle errors
function getBoundMethod(fn: Function, target: any, receiver: any): Function {
let boundMethodsForTarget = bindCache.get(target)
if (boundMethodsForTarget === void 0) {
export function renderInstanceRoot(instance: ComponentInstance): VNode {
let vnode
const { render, $proxy, $props, $slots, $attrs, $parentVNode } = instance
+ if (__DEV__) {
+ isRendering = true
+ }
try {
- if (__DEV__) {
- isRendering = true
- }
vnode = render.call($proxy, $props, $slots, $attrs, $parentVNode)
+ } catch (err) {
if (__DEV__) {
isRendering = false
}
- } catch (err) {
handleError(err, instance, ErrorTypes.RENDER)
}
+ if (__DEV__) {
+ isRendering = false
+ }
return normalizeComponentRoot(vnode, $parentVNode)
}
) {
try {
const res = hook.call(instanceProxy, arg)
- if (res && typeof res.then === 'function') {
+ if (res && !res._isVue && typeof res.then === 'function') {
;(res as Promise<any>).catch(err => {
handleError(err, instanceProxy._self, type)
})
if (contextVNode) {
pushWarningContext(contextVNode)
}
- warn(`Unhandled error${info ? ` ${info}` : ``}`)
+ if (/private field/.test(err.message)) {
+ warn(
+ `Private fields are not supported in component classes because they ` +
+ `cannot be tunneled through Proxies.`
+ )
+ } else {
+ warn(`Unhandled error${info ? ` ${info}` : ``}`)
+ }
+ console.error(err)
if (contextVNode) {
popWarningContext()
}
- console.error(err)
} else {
throw err
}