I am getting this weird error I cannot track down.
I have a server-side only Method which I call.
In my debugger the server-side call never gives an error and performs as expected:
Here is the server code:
if (!myItem.long_url) {
// nothing to shorten, just save
myItem.short_link = ""; // clear if needed
if (myItem._id) {
LibraryItems.update(myItem._id, {$set:myItem}, (err, cnt)=> {
if (err){
console.log("0 err: " + err);
throw new Meteor.Error('Error', err);
}
});
} else {
LibraryItems.insert(<LibraryItem>myItem);
}
return "success";
}
The culprite is the “update”. The update is successful on the database…but i get the exception below and my app locks up. And it is intermintent?
The client side call…always returns success.
Client code:
this.call('save.library.item', this.selectedItem, (err, res)=> {
console.log("err: " + err);
console.log("res: " + res);
if (res == "success"){
//success
this.generateTags();
console.log("3");
this.childModal.hide();
console.log("Succesfully saved...");
} else {
console.log("Failed save..." + err);
}
}, true);
I have no idea.
Exception in queued task: TypeError: Cannot read property 'type' of undefined
at _View_Library2.detectChangesInternal (Library.template.js:1752:42)
at _View_Library2.AppView.detectChanges (http://localhost:3000/packages/modules.js?hash=055cd96324e091a102dbaabeb4a6fc6a3ec0d7bf:12713:14)
at _View_Library0.AppView.detectContentChildrenChanges (http://localhost:3000/packages/modules.js?hash=055cd96324e091a102dbaabeb4a6fc6a3ec0d7bf:12731:19)
at _View_Library0.detectChangesInternal (Library.template.js:1046:8)
at _View_Library0.AppView.detectChanges (http://localhost:3000/packages/modules.js?hash=055cd96324e091a102dbaabeb4a6fc6a3ec0d7bf:12713:14)
at _View_Library_Host0.AppView.detectViewChildrenChanges (http://localhost:3000/packages/modules.js?hash=055cd96324e091a102dbaabeb4a6fc6a3ec0d7bf:12739:19)
at _View_Library_Host0.detectChangesInternal (Library.template.js:36:8)
at _View_Library_Host0.AppView.detectChanges (http://localhost:3000/packages/modules.js?hash=055cd96324e091a102dbaabeb4a6fc6a3ec0d7bf:12713:14)
at _View_Saturn0.AppView.detectContentChildrenChanges (http://localhost:3000/packages/modules.js?hash=055cd96324e091a102dbaabeb4a6fc6a3ec0d7bf:12731:19)
at _View_Saturn0.AppView.detectChangesInternal (http://localhost:3000/packages/modules.js?hash=055cd96324e091a102dbaabeb4a6fc6a3ec0d7bf:12723:14)
app.js:1553 err: undefined
app.js:1554 res: success
app.js:1558 3
app.js:1560 Succesfully saved…
browser_adapter.js:93 EXCEPTION: SyntaxError: Unexpected token u in JSON at position 0
browser_adapter.js:84 EXCEPTION: SyntaxError: Unexpected token u in JSON at position 0BrowserDomAdapter.logError @ browser_adapter.js:84BrowserDomAdapter.logGroup @ browser_adapter.js:94ExceptionHandler.call @ exception_handler.js:65(anonymous function) @ application_ref.js:337schedulerFn @ async.js:139SafeSubscriber.__tryOrUnsub @ Subscriber.js:225SafeSubscriber.next @ Subscriber.js:174Subscriber._next @ Subscriber.js:124Subscriber.next @ Subscriber.js:88Subject._finalNext @ Subject.js:128Subject._next @ Subject.js:120Subject.next @ Subject.js:77EventEmitter.emit @ async.js:127onError @ ng_zone.js:124onHandleError @ ng_zone_impl.js:74ZoneDelegate.handleError @ zone.js:310Zone.runGuarded @ zone.js:218NgZoneImpl.runInnerGuarded @ ng_zone_impl.js:86NgZone.runGuarded @ ng_zone.js:240outsideHandler @ dom_events.js:27ZoneDelegate.invokeTask @ zone.js:339Zone.runTask @ zone.js:237ZoneTask.invoke @ zone.js:405
browser_adapter.js:84 STACKTRACE:BrowserDomAdapter.logError @ browser_adapter.js:84ExceptionHandler.call @ exception_handler.js:67(anonymous function) @ application_ref.js:337schedulerFn @ async.js:139SafeSubscriber.__tryOrUnsub @ Subscriber.js:225SafeSubscriber.next @ Subscriber.js:174Subscriber._next @ Subscriber.js:124Subscriber.next @ Subscriber.js:88Subject._finalNext @ Subject.js:128Subject._next @ Subject.js:120Subject.next @ Subject.js:77EventEmitter.emit @ async.js:127onError @ ng_zone.js:124onHandleError @ ng_zone_impl.js:74ZoneDelegate.handleError @ zone.js:310Zone.runGuarded @ zone.js:218NgZoneImpl.runInnerGuarded @ ng_zone_impl.js:86NgZone.runGuarded @ ng_zone.js:240outsideHandler @ dom_events.js:27ZoneDelegate.invokeTask @ zone.js:339Zone.runTask @ zone.js:237ZoneTask.invoke @ zone.js:405
browser_adapter.js:84 SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse ()
at Library.editTweet (library.component.ts:149)
at _View_Library2._handle_click_24_0 (Library.template.js:1798)
at dom_renderer.js:254
at dom_events.js:27
at ZoneDelegate.invoke (zone.js:306)
at Object.onInvoke (ng_zone_impl.js:53)
at ZoneDelegate.invoke (zone.js:305)
at Zone.runGuarded (zone.js:215)
at NgZoneImpl.runInnerGuarded (ng_zone_impl.js:86)BrowserDomAdapter.logError @ browser_adapter.js:84ExceptionHandler.call @ exception_handler.js:68(anonymous function) @ application_ref.js:337schedulerFn @ async.js:139SafeSubscriber.__tryOrUnsub @ Subscriber.js:225SafeSubscriber.next @ Subscriber.js:174Subscriber._next @ Subscriber.js:124Subscriber.next @ Subscriber.js:88Subject._finalNext @ Subject.js:128Subject._next @ Subject.js:120Subject.next @ Subject.js:77EventEmitter.emit @ async.js:127onError @ ng_zone.js:124onHandleError @ ng_zone_impl.js:74ZoneDelegate.handleError @ zone.js:310Zone.runGuarded @ zone.js:218NgZoneImpl.runInnerGuarded @ ng_zone_impl.js:86NgZone.runGuarded @ ng_zone.js:240outsideHandler @ dom_events.js:27ZoneDelegate.invokeTask @ zone.js:339Zone.runTask @ zone.js:237ZoneTask.invoke @ zone.js:405
zone.js:241 Uncaught SyntaxError: Unexpected token u in JSON at position 0(…)Library.editTweet @ library.component.ts:149_View_Library2._handle_click_24_0 @ Library.template.js:1798(anonymous function) @ dom_renderer.js:254(anonymous function) @ dom_events.js:27ZoneDelegate.invoke @ zone.js:306onInvoke @ ng_zone_impl.js:53ZoneDelegate.invoke @ zone.js:305Zone.runGuarded @ zone.js:215NgZoneImpl.runInnerGuarded @ ng_zone_impl.js:86NgZone.runGuarded @ ng_zone.js:240outsideHandler @ dom_events.js:27ZoneDelegate.invokeTask @ zone.js:339Zone.runTask @ zone.js:237ZoneTask.invoke @ zone.js:405