commit 3fab015db733ffc6a53521746f3e86d7180b6b94
parent b07c086fd4f25b632c3b3dff873287bab3703a34
Author: MTRNord <mtrnord1@gmail.com>
Date: Mon, 26 Feb 2018 20:12:25 +0100
USe the error handler instead of directly calling Raven
Diffstat:
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
@@ -16,7 +16,6 @@ import { TweetListComponent } from './tweet-list/tweet-list.component';
import { PapersListComponent } from './papers-list/papers-list.component';
import { ApiService } from './api.service';
-import {ServiceWorkerModule} from '@angular/service-worker';
import * as Raven from 'raven-js';
Raven
@@ -29,7 +28,11 @@ Raven
export class RavenErrorHandler implements ErrorHandler {
handleError(err: any ): void {
- Raven.captureException(err);
+ if (err !== typeof Error) {
+ Raven.captureException(err);
+ } else {
+ Raven.captureException(new Error(JSON.stringify(err)));
+ }
}
}
diff --git a/src/app/papers-list/papers-list.component.ts b/src/app/papers-list/papers-list.component.ts
@@ -22,7 +22,7 @@ export class PapersListComponent {
this.apiService.getPapers()
.subscribe(
data => { this.data = this.chunk(data, 3); },
- err => Raven.captureException(new Error(JSON.stringify(err))),
+ err => { throw err; },
() => console.log('done loading Papers')
);
}
diff --git a/src/app/tweet-list/tweet-list.component.ts b/src/app/tweet-list/tweet-list.component.ts
@@ -30,7 +30,7 @@ export class TweetListComponent implements OnInit {
this.apiService.getYesterday(this.uuid)
.subscribe(
data => { this.data = this.chunk(data.tweets, 3); },
- err => Raven.captureException(new Error(JSON.stringify(err))),
+ err => { throw err; },
() => console.log('done loading Yesterday')
);
}