Change all js throw string to throw error in notebook/static

This commit is contained in:
Thomas Fors 2016-02-20 13:03:48 -06:00
parent 620fb29192
commit 8d68bdcf25
3 changed files with 4 additions and 4 deletions

View File

@ -325,7 +325,7 @@ define([
if(typeof(current_node) === 'string'){
delete tree[shortcut_array[0]];
} else {
throw('try to delete non-leaf');
throw new Error('try to delete non-leaf');
}
} else {
this._remove_leaf(shortcut_array.slice(1), tree[shortcut_array[0]], allow_node);

View File

@ -52,7 +52,7 @@ define([
*/
NotificationArea.prototype.get_widget = function (name) {
if(this.widget_dict[name] === undefined) {
throw('no widgets with this name');
throw new Error('no widgets with this name');
}
return this.widget_dict[name];
};
@ -66,7 +66,7 @@ define([
*/
NotificationArea.prototype.new_notification_widget = function (name) {
if (this.widget_dict[name] !== undefined) {
throw('widget with that name already exists!');
throw new Error('widget with that name already exists!');
}
// create the element for the notification widget and add it

View File

@ -686,7 +686,7 @@ define(function(require){
data = {handler:data};
}
if(typeof(data.handler) !== 'function'){
throw('unknown datatype, cannot register');
throw new Error('unknown datatype, cannot register');
}
var _data = data;
data = {};