Trying to catch promise and json parse errors. #489 (#490)

* Trying to catch promise and json parse errors. #489

* A few more promises.
This commit is contained in:
Dessalines 2021-11-17 16:23:46 -05:00 committed by GitHub
parent b167deeebf
commit ba06c1ae47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 379 additions and 243 deletions

View file

@ -26,7 +26,11 @@ export class WebSocketService {
this.subject = new Observable((obs: any) => {
this.ws.onmessage = e => {
obs.next(JSON.parse(e.data));
try {
obs.next(JSON.parse(e.data));
} catch (err) {
console.log(err);
}
};
this.ws.onopen = () => {
console.log(`Connected to ${wsUri}`);