Просмотр исходного кода

add informative error message about view not existing

Adam Shaw 8 лет назад
Родитель
Сommit
6161576b76
1 измененных файлов с 4 добавлено и 0 удалено
  1. 4 0
      src/Calendar.ts

+ 4 - 0
src/Calendar.ts

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