TxSSC/Card-Catalog — pull request #4 by particlebanana (2012-08-13 18:37:36+00:00)
Title: Error handling

This allows you to pass in an error handling function when the catalog is created.

All it does is catch an error event on the Category or Collection classes and run it through the error_handler function. It doen't pass in the req object but if that becomes an issue it's easy to add.

The test will fail with 2 errors when it tries to catch an error from an instantiated card. I'm tweaking the card class a bit to work with a before array of middleware and it will be fixed in there.

``` js
var catalog = new card_catalog.Category({
connection: connection,
namespace: 'example_namespace',
error_handler: function(res, err) {
// Do something with the error
}
});
```