我的Javascript程序在Google Chrome和Firefox上都创建了“对象已存在”错误。 哪种错误可能会触发此错误消息?我很难在不知道错误含义的情况下调试此错误。
答案 0 :(得分:3)
根据你的评论:
所有JavaScript都是'开源'(尽管它可以缩小等),因此您只需搜索该确切的字符串即可。我得到的唯一结果是用作错误:http://uxebu.com/blog/2011/04/27/creating-a-persistent-dojo-object-store/。
store.add = function(object, options){
// Get the id
var id = options && options.id || object.id;
// Check if something exists under the given
// id -- StorageJS always returns null when
// there's no data for a certain key.
if(storage.get(id) !== null){
throw new Error("Object already exists"); // <-- did it somehow get here?
}
// We're save to go now! So hand over the
// request to the put() method.
store.put(object, options);
};
答案 1 :(得分:1)
下次尝试使用调试器来中断异常