Skip to content

Commit

Permalink
Actually use the error reporting.
Browse files Browse the repository at this point in the history
chapter9-2
  • Loading branch information
tmeasday committed Oct 19, 2015
1 parent 65dde1f commit 816d381
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions client/templates/posts/post_edit.js
Expand Up @@ -12,7 +12,7 @@ Template.postEdit.events({
Posts.update(currentPostId, {$set: postProperties}, function(error) {
if (error) {
// display the error to the user
alert(error.reason);
throwError(error.reason);
} else {
Router.go('postPage', {_id: currentPostId});
}
Expand All @@ -28,4 +28,4 @@ Template.postEdit.events({
Router.go('postsList');
}
}
});
});
4 changes: 2 additions & 2 deletions client/templates/posts/post_submit.js
Expand Up @@ -10,11 +10,11 @@ Template.postSubmit.events({
Meteor.call('postInsert', post, function(error, result) {
// display the error to the user and abort
if (error)
return alert(error.reason);
return throwError(error.reason);

// show this result but route anyway
if (result.postExists)
alert('This link has already been posted');
throwError('This link has already been posted');

Router.go('postPage', {_id: result._id});
});
Expand Down

0 comments on commit 816d381

Please sign in to comment.