Permalink
Browse files

Actually use the error reporting.

chapter9-2
  • Loading branch information...
tmeasday committed Apr 8, 2013
1 parent 65dde1f commit 816d38172b37ec2177fccf06cab746ad27bd452c
Showing with 4 additions and 4 deletions.
  1. +2 −2 client/templates/posts/post_edit.js
  2. +2 −2 client/templates/posts/post_submit.js
@@ -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});
}
@@ -28,4 +28,4 @@ Template.postEdit.events({
Router.go('postsList');
}
}
-});
+});
@@ -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});
});

0 comments on commit 816d381

Please sign in to comment.