Skip to content

Commit

Permalink
Merge pull request #187 from niole/master
Browse files Browse the repository at this point in the history
updated keyboard.js to throw errors instead of strings.
  • Loading branch information
minrk committed Jul 8, 2015
2 parents e8b3c17 + 3db5083 commit cead281
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions notebook/static/base/js/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ define([
};

ShortcutManager.prototype.set_shortcut = function( shortcut, action_name){
if( typeof(action_name) !== 'string'){ throw('action is not a string', action_name);}
if( typeof(action_name) !== 'string'){throw new Error('action is not a string', action_name);}
if( typeof(shortcut) === 'string'){
shortcut = shortcut.split(',');
}
Expand Down Expand Up @@ -351,9 +351,8 @@ define([
**/
var action_name = this.actions.get_name(data);
if (! action_name){
throw('does not know how to deal with ', data);
throw new Error('does not know how to deal with', data);
}

shortcut = normalize_shortcut(shortcut);
this.set_shortcut(shortcut, action_name);

Expand Down Expand Up @@ -397,7 +396,7 @@ define([
this.events.trigger('rebuild.QuickHelp');
}
} catch (ex) {
throw ('try to remove non-existing shortcut');
throw new Error('trying to remove a non-existent shortcut', shortcut);
}
};

Expand Down

0 comments on commit cead281

Please sign in to comment.