feat: error handling for setup / render / watch / event handlers

This commit is contained in:
Evan You
2019-08-30 15:05:39 -04:00
parent 1d55b368e8
commit 966d7b5487
11 changed files with 219 additions and 72 deletions

View File

@@ -5,7 +5,9 @@ export interface InjectionKey<T> extends Symbol {}
export function provide<T>(key: InjectionKey<T> | string, value: T) {
if (!currentInstance) {
// TODO warn
if (__DEV__) {
warn(`provide() is used without an active component instance.`)
}
} else {
let provides = currentInstance.provides
// by default an instance inherits its parent's provides object