Skip to content

Commit df8f049

Browse files
author
Jake Reynolds
committed
adding error handling for invalid views
1 parent 3e23ddd commit df8f049

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

javascripts/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@ function loadPage() {
2525
$("#contentContainer").prepend(ABSOLUTE_LOADER);
2626
if (pageType != TAB_PAGE_TYPE) { //Tabbed pages need to be handled differently
2727
$.get('/views/' + pageType + '.html?' + VERSION, function(response, data) {
28-
$('#contentContainer').html(response);
29-
if ($('#contentContainer .injectionDescription')) {
30-
loadInjectionDescriptions();
28+
if (response.indexOf('<head>') > -1 && response.indexOf('<title>SQL') > -1) {
29+
//Whatever view it is, we don't have it and it defaulted to index.html
30+
debugger;
31+
window.location.pathname = '/';
32+
} else {
33+
$('#contentContainer').html(response);
34+
if ($('#contentContainer .injectionDescription')) {
35+
loadInjectionDescriptions();
36+
}
3137
}
3238
})
3339
} else {

0 commit comments

Comments
 (0)