(function (){
  "use strict";

  function getBoardID(){
    var pathname = window.location.pathname;
    var regex = /\/b\/(\w*)(\/*)/;
    var boardID = regex.exec(pathname);
    if(!boardID){
      alert('Not a Trello board!');
      return;
    }
    return boardID[1];
  }

})();

(function (){
  "use strict";

  function getBoardID(){
    var pathname = window.location.pathname;
    var boardID = /\/b\/(\w*)(\/*)/.exec(pathname);
    if(!boardID){
      alert('Not a Trello board!');
      throw 'Cannot detect Trello board';
    }
    return boardID[1];
  }
})();

Throw error when not able to find board ID
Throw error when not able to find board ID
