Explorar o código

add informative error message about view not existing

Adam Shaw %!s(int64=8) %!d(string=hai) anos
pai
achega
6161576b76
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      src/Calendar.ts

+ 4 - 0
src/Calendar.ts

@@ -171,6 +171,10 @@ export default class Calendar {
   instantiateView(viewType: string): View {
   instantiateView(viewType: string): View {
     let spec = this.viewSpecManager.getViewSpec(viewType)
     let spec = this.viewSpecManager.getViewSpec(viewType)
 
 
+    if (!spec) {
+      throw new Error(`View type "${viewType}" is not valid`)
+    }
+
     return new spec['class'](this, spec)
     return new spec['class'](this, spec)
   }
   }