luci-base: view.htm: catch and render exceptions on view instantiation
authorJo-Philipp Wich <jo@mein.io>
Wed, 11 Sep 2019 10:21:51 +0000 (12:21 +0200)
committerJo-Philipp Wich <jo@mein.io>
Wed, 11 Sep 2019 10:21:51 +0000 (12:21 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/luasrc/view/view.htm

index bddd8e4464ac50661e364bceacf5467c57941f11..9220ecf2992e1803f46e6547f5ef65ce636da8ef 100644 (file)
@@ -2,7 +2,10 @@
 
 <div id="view">
        <div class="spinning"><%:Loading view…%></div>
-       <script type="text/javascript">L.require('view.<%=view%>');</script>
+       <script type="text/javascript">L.require('view.<%=view%>').catch(function(err) {
+               L.dom.content(document.querySelector('#view'), null);
+               L.error(err);
+       });</script>
 </div>
 
 <%+footer%>