1
votes

last recently, using Angular6 I started to observe exceptionally poorly descriptive stacktrace in the browser console:

ERROR Error: "[object Object]"
resolvePromise
http://localhost:8080/polyfills.js:3136:31 resolvePromise
http://localhost:8080/polyfills.js:3093:17 scheduleResolveOrReject
http://localhost:8080/polyfills.js:3195:17 invokeTask
http://localhost:8080/polyfills.js:2743:17 onInvokeTask
http://localhost:8080/vendor.js:36899:24 invokeTask
http://localhost:8080/polyfills.js:2742:17 runTask
http://localhost:8080/polyfills.js:2510:28 drainMicroTaskQueue
http://localhost:8080/polyfills.js:2917:25 invokeTask
http://localhost:8080/polyfills.js:2822:21 invokeTask
http://localhost:8080/polyfills.js:3862:9 globalZoneAwareCallback
http://localhost:8080/polyfills.js:3888:17 core.js:1673
defaultErrorLogger
core.js:1673
./node_modules/@angular/core/fesm5/core.js
/ErrorHandler.prototype.handleError
core.js:1719
next
core.js:4319:109
./node_modules/@angular/core/fesm5/core.js
/EventEmitter.prototype.subscribe/schedulerFn<
core.js:3555:34
./node_modules/rxjs/_esm5/internal/Subscriber.js
/SafeSubscriber.prototype.__tryOrUnsub
Subscriber.js:195
./node_modules/rxjs/_esm5/internal/Subscriber.js
/SafeSubscriber.prototype.next
Subscriber.js:133
./node_modules/rxjs/_esm5/internal/Subscriber.js
/Subscriber.prototype._next
Subscriber.js:77
./node_modules/rxjs/_esm5/internal/Subscriber.js
/Subscriber.prototype.next
Subscriber.js:54
./node_modules/rxjs/_esm5/internal/Subject.js/Subject.prototype.next
Subject.js:47
./node_modules/@angular/core/fesm5/core.js/EventEmitter.prototype.emit
core.js:3539:52
onHandleError/<
core.js:3846:48
./node_modules/zone.js/dist/zone.js/ zone.js:388
./node_modules/zone.js/dist/zone.js/ zone.js:138
./node_modules/@angular/core/fesm5/core.js
/NgZone.prototype.runOutsideAngular
core.js:3783
onHandleError
core.js:3846
./node_modules/zone.js/dist/zone.js
/ zone.js:392
./node_modules/zone.js/dist/zone.js/ zone.js:154
_loop_1
zone.js:677
./node_modules/zone.js/dist/zone.js/ zone.js:686
drainMicroTaskQueue
zone.js:602
./node_modules/zone.js/dist/zone.js/ zone.js:500
invokeTask
zone.js:1540
globalZoneAwareCallback
zone.js:1566

My suspicion is some error in routing module so I'm pasting my config:

const routes = [
  {
    path: 'wordspreview/:id',
    component: WordsPreviewComponent
  },
  {
    path: 'wordspreview',
    component: WordsPreviewComponent
  },
  {
    path: 'search/:query',
    component: SearchResultsComponent
  },
  {
    path: '',
    redirectTo: '/wordspreview',
    pathMatch: 'full'
  }
};

Hope someone could help.

1

1 Answers

0
votes

I just found the bug for myself.

Unable to google it anywhere else, I will leave solution here to help next potential victims:

constructor(private router : Router,
[...]
this.router.navigate([site, id]);

What I did wrong was to navigate into wrong site. It was difficult to debug because it appeared only for some rare erroneous site values.