Skip to content

Commit

Permalink
Merge pull request #115 from pfeyz/throw-error-on-missing-page-2
Browse files Browse the repository at this point in the history
throw error when page is loaded without preloading
  • Loading branch information
gureckis committed Jul 2, 2014
2 parents d647cd9 + 28fc515 commit c02c1f2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions psiturk/psiturk_js/psiturk.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ var PsiTurk = function(uniqueId, adServerLoc) {
};
// Get HTML file from collection and pass on to a callback
self.getPage = function(pagename) {
if (!(pagename in self.pages)){
throw new Error(
["Attemping to load page before preloading: ",
pagename].join(""));
};
return self.pages[pagename];
};

Expand Down

0 comments on commit c02c1f2

Please sign in to comment.