角度巨大的堆栈跟踪

时间:2017-07-27 11:19:43

标签: angular

我在chrome控制台中得到异常堆栈跟踪,这是283行,引用我的代码的行是80 - 81(搜索单词卡)。

  at CardService.getCards (eval at 70
 (http://localhost:8080/app.js:142:1), <anonymous>:46:14)
     at CardsComponent.ngOnInit (eval at 144 (http://localhost:8080/app.js:7:1), <anonymous>:19:26)

我想知道为什么所有的垃圾都会变成异常,有没有办法摆脱它?

Stacktrace(减少了一点)

 (unknown) ERROR Error: Uncaught (in promise): Response with status:
 401 Unauthorized for URL: http://localhost:5000/api/user
     at resolvePromise (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:783:31)
     at resolvePromise (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:754:17)
     at eval (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:831:17)
     at ZoneDelegate.invokeTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:424:31)
     at Object.onInvokeTask (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:4085:33)
     at ZoneDelegate.invokeTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:423:36)
     at Zone.runTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:191:47)
     at drainMicroTaskQueue (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:595:35)
     at ZoneTask.invokeTask [as invoke] (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:502:21)
     at invokeTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:1364:14)
     at XMLHttpRequest.globalZoneAwareCallback (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:1382:17)
     at ____________________Elapsed_13_ms__At__Thu_Jul_27_2017_14_51_10_GMT_0300__Turkey_Standard_Time_
 (http://localhost)
     at Object.onScheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2706:1), <anonymous>:109:22)
     at ZoneDelegate.scheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:404:51)
     at Object.onScheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:300:29)
     at ZoneDelegate.scheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:404:51)
     at Zone.scheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:235:43)
     at Zone.scheduleMicroTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:255:25)
     at scheduleResolveOrReject (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:829:14)
     at resolvePromise (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:778:21)
     at resolvePromise (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:754:17)
     at eval (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:831:17)
     at ZoneDelegate.invokeTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:424:31)
     at Object.onInvokeTask (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:4085:33)
     at ZoneDelegate.invokeTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:423:36)
     at Zone.runTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:191:47)
     at drainMicroTaskQueue (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:595:35)
     at ZoneTask.invokeTask [as invoke] (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:502:21)
     at invokeTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:1364:14)
     at XMLHttpRequest.globalZoneAwareCallback (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:1382:17)
     at ____________________Elapsed_1_ms__At__Thu_Jul_27_2017_14_51_10_GMT_0300__Turkey_Standard_Time_
 (http://localhost)
     at Object.onScheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2706:1), <anonymous>:109:22)
     at ZoneDelegate.scheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:404:51)
     at Object.onScheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:300:29)
     at ZoneDelegate.scheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:404:51)
     at Zone.scheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:235:43)
     at Zone.scheduleMicroTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:255:25)
     at scheduleResolveOrReject (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:829:14)
     at resolvePromise (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:778:21)
     at eval (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:709:17)
     at SafeSubscriber.eval [as _error] (eval at <anonymous> (http://localhost:8080/vendor.js:2626:1), <anonymous>:68:85)
     at SafeSubscriber.__tryOrUnsub (eval at <anonymous> (http://localhost:8080/vendor.js:14:1), <anonymous>:238:16)
     at SafeSubscriber.error (eval at <anonymous> (http://localhost:8080/vendor.js:14:1), <anonymous>:197:26)
     at Subscriber._error (eval at <anonymous> (http://localhost:8080/vendor.js:14:1), <anonymous>:128:26)
     at Subscriber.error (eval at <anonymous> (http://localhost:8080/vendor.js:14:1), <anonymous>:102:18)
     at XMLHttpRequest.onLoad (eval at <anonymous> (http://localhost:8080/vendor.js:336:1), <anonymous>:1270:34)
     at ZoneDelegate.invokeTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:424:31)
     at Object.onInvokeTask (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:4085:33)
     at ZoneDelegate.invokeTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:423:36)
     at Zone.runTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:191:47)
     at ZoneTask.invokeTask [as invoke] (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:498:34)
     at invokeTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:1364:14)
     at XMLHttpRequest.globalZoneAwareCallback (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:1382:17)
     at ____________________Elapsed_94_ms__At__Thu_Jul_27_2017_14_51_10_GMT_0300__Turkey_Standard_Time_
 (http://localhost)
     at Object.onScheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2706:1), <anonymous>:109:22)
     at ZoneDelegate.scheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:404:51)
     at Object.onScheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:300:29)
     at ZoneDelegate.scheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:404:51)
     at Zone.scheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:235:43)
     at Zone.scheduleEventTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:261:25)
     at XMLHttpRequest.eval [as addEventListener] (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:1634:33)
     at XMLHttpRequest.__zone_symbol__send (<anonymous>:1:682)
     at ZoneTask.scheduleTask [as scheduleFn] (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:2616:24)
     at ZoneDelegate.scheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:410:26)
     at Object.onScheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2706:1), <anonymous>:117:35)
     at ZoneDelegate.scheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:404:51)
     at Object.onScheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:300:29)
     at ZoneDelegate.scheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:404:51)
     at Zone.scheduleTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:235:43)
     at Zone.scheduleMacroTask (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:258:25)
     at eval (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:2640:29)
     at XMLHttpRequest.proto.(anonymous function) [as send] (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1),
 <anonymous>:1221:20)
     at Observable.eval [as _subscribe] (eval at <anonymous> (http://localhost:8080/vendor.js:336:1), <anonymous>:1314:18)
     at Observable._trySubscribe (eval at <anonymous> (http://localhost:8080/vendor.js:6:1), <anonymous>:171:25)
     at Observable.subscribe (eval at <anonymous> (http://localhost:8080/vendor.js:6:1), <anonymous>:159:65)
     at eval (eval at <anonymous> (http://localhost:8080/vendor.js:2626:1), <anonymous>:68:15)
     at new ZoneAwarePromise (eval at <anonymous> (http://localhost:8080/polyfills.js:2712:1), <anonymous>:847:29)
     at Observable.toPromise (eval at <anonymous> (http://localhost:8080/vendor.js:2626:1), <anonymous>:66:12)
     at CardService.getCards (eval at 70 (http://localhost:8080/app.js:142:1), <anonymous>:46:14)
     at CardsComponent.ngOnInit (eval at 144 (http://localhost:8080/app.js:7:1), <anonymous>:19:26)
     at checkAndUpdateDirectiveInline (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:11038:19)
     at checkAndUpdateNodeInline (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:12534:17)
     at checkAndUpdateNode (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:12473:16)
     at debugCheckAndUpdateNode (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:13334:59)
     at debugCheckDirectivesFn (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:13275:13)
     at Object.eval [as updateDirectives] (ng:///AppModule/CardsComponent_Host.ngfactory.js:8:5)
     at Object.debugUpdateDirectives [as updateDirectives] (eval at <anonymous> (http://localhost:8080/vendor.js:67:1),
 <anonymous>:13260:21)
     at checkAndUpdateView (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:12440:14)
     at callViewAction (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:12805:21)
     at execEmbeddedViewsAction (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:12763:17)
     at checkAndUpdateView (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:12441:5)
     at callViewAction (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:12805:21)
     at execComponentViewsAction (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:12737:13)
     at checkAndUpdateView (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:12446:5)
     at callWithDebugContext (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:13660:42)
     at Object.debugCheckAndUpdateView [as checkAndUpdateView] (eval at <anonymous> (http://localhost:8080/vendor.js:67:1),
 <anonymous>:13200:12)
     at ViewRef_.detectChanges (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:10371:18)
     at eval (eval at <anonymous> (http://localhost:8080/vendor.js:67:1), <anonymous>:5009:63)
     at Array.forEach (<anonymous>)

1 个答案:

答案 0 :(得分:0)

前两行也是相关的我认为?

(unknown) ERROR Error: Uncaught (in promise): Response with status: 401 Unauthorized for URL: http://localhost:5000/api/user

请问会导致ngOnInit失败吗?