Skip to content
Permalink
Browse files

Basic error reporting.

chapter9-1
  • Loading branch information
tmeasday committed Oct 19, 2015
1 parent 2df3a7a commit 65dde1fe2393e5e723b622454548a42a2a26ea28
@@ -0,0 +1,6 @@
// Local (client-only) collection
Errors = new Mongo.Collection(null);

throwError = function(message) {
Errors.insert({message: message})
}
@@ -1,6 +1,7 @@
<template name="layout">
<div class="container">
{{> header}}
{{> errors}}
<div id="main">
{{> yield}}
</div>
@@ -0,0 +1,14 @@
<template name="errors">
<div class="errors">
{{#each errors}}
{{> error}}
{{/each}}
</div>
</template>

<template name="error">
<div class="alert alert-danger" role="alert">
<button type="button" class="close" data-dismiss="alert">&times;</button>
{{message}}
</div>
</template>
@@ -0,0 +1,5 @@
Template.errors.helpers({
errors: function() {
return Errors.find();
}
});

1 comment on commit 65dde1f

@qiulang

This comment has been minimized.

Copy link

@qiulang qiulang commented on 65dde1f May 17, 2017

I feel rather confused now, why we put throwError function in client/helpers/errors.js, why not in client/templates/includes/errors.js ? After all they are both inside client folder ?

throwError = function(message) {
   Errors.insert({message: message})
} 
Please sign in to comment.
You can’t perform that action at this time.