JSPM

  • Created
  • Published
  • Downloads 7866
  • Score
    100M100P100Q13119F

Convenient error handling for Feathers services.

Package Exports

  • feathers-errors

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (feathers-errors) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

feathers-errors Build Status

Error handling mixin for Feathers apps.

Getting Started

Install the module with: npm install feathers-errors --save

var feathers = require('feathers');
var errors = require('feathers-errors');

var app = feathers().configure(errors())
  .use('/users', userService)
  .use('/posts', postsService)
  .use(errors.handler);

Documentation

Definition and use with REST URIs:

// Both associations should only work if there is a /users service registered already
app.use('/users', userService)
  .use('/posts', postsService)
  .use('/accounts', accountService);

// Pass service name in an array
// Calls postsService.findAll({ userId: <userId> })
app.associate('/users/:userId/posts', ['posts']);

// Calls userService.get(<userId>) then calls
// accountService.get(user.account)
app.associate('/users/:userId/account', 'accounts');

For SocketIO:

socket.emit('/users/:userId/posts', { userId: 123 }, function(error, posts) {
});

Examples

See examples directory.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

(Nothing yet)

License

Copyright (c) 2014 Eric Kryski Licensed under the MIT license.