Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
fix(spaces): fix error handling in resolveOwner and resolveOwners (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
ppitonak authored and joshuawilson committed Jan 10, 2019
1 parent f96226b commit fbb23f4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/app/spaces/space.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from '@angular/common/http';

import {
empty as emptyObservable,
from as observableFrom,
Observable,
of as observableOf,
Expand Down Expand Up @@ -242,13 +241,16 @@ export class SpaceService {

if (!space.relationships['owned-by'] || !space.relationships['owned-by'].data) {
space.relationalData.creator = null;
return;
return observableThrowError('Relationships in space object not defined');
}
return this.userService.getUserByUserId(space.relationships['owned-by'].data.id)
.pipe(
map((owner: User): Space => {
space.relationalData.creator = owner;
return space;
}),
catchError(error => {
return this.handleError(error);
})
);
}
Expand All @@ -267,9 +269,7 @@ export class SpaceService {
this.userService.getUserByUserId(ownerId)
.pipe(
catchError(error => {
console.log('Error fetching user', ownerId, error);
this.handleError(error);
return emptyObservable();
return this.handleError(error);
})
)
),
Expand Down

0 comments on commit fbb23f4

Please sign in to comment.