Skip to content

Commit fa98c6b

Browse files
TimHarkerMarkPieszak
authored andcommitted
User Rest API Demo - Error Handling (TrilonIO#241)
* User Rest API Demo - Error Handling Fixed error handling to actually show the alert, on error. * Console Log Changed from `alert` to `console.log`.
1 parent 73a3f98 commit fa98c6b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Client/app/containers/users/users.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ export class UsersComponent implements OnInit {
5353
if (result.ok) {
5454
let position = this.users.indexOf(user);
5555
this.users.splice(position, 1);
56-
} else {
57-
alert('There was an issue, Could not delete user');
5856
}
57+
}, error => {
58+
console.log(`There was an issue. ${error._body}.`);
5959
});
6060
}
6161

@@ -64,9 +64,9 @@ export class UsersComponent implements OnInit {
6464
console.log('Post user result: ', result);
6565
if (result.ok) {
6666
this.users.push(result.json());
67-
} else {
68-
alert('There was an issue, Could not edit user');
6967
}
68+
}, error => {
69+
console.log(`There was an issue. ${error._body}.`);
7070
});
7171
}
7272
}

0 commit comments

Comments
 (0)