Skip to content
This repository has been archived by the owner on Mar 22, 2022. It is now read-only.

Throw errors for deprecated hooks and update documentation #134

Closed
petermikitsh opened this issue Mar 28, 2016 · 1 comment
Closed

Throw errors for deprecated hooks and update documentation #134

petermikitsh opened this issue Mar 28, 2016 · 1 comment
Milestone

Comments

@petermikitsh
Copy link
Contributor

I was running into vague errors when I began adding authentication hooks, e.g.,

.../services/signature/hooks.js:44
sAuthentication.hooks.populateUser(), _feathersAuthentication.hooks.requireAut
                                                                    ^
TypeError: undefined is not a function
    at Object.<anonymous> (hooks.js:43:15)
    at Module._compile (module.js:460:26)

because I was requiring a deprecated hook:

import { hooks as authHooks } from 'feathers-authentication';

exports.before = {
  create: [
    ...
    authHooks.requireAuth(), // bad
    ...
  ]
}

when I really wanted this:

import { hooks as authHooks } from 'feathers-authentication';

exports.before = {
  create: [
    ...
    authHooks.restrictToAuthenticated(), // good
    ...
  ]
}

Then I saw the new documentation in the README which helped me out, but a clearer message in the console would be preferred. The authentication hooks documentation references the deprecated names.

@ekryski
Copy link
Member

ekryski commented Mar 28, 2016

Sorry yes we haven't gotten around to updating the docs just yet. Some new fixes are going in first to avoid doing work twice. Related to #129.

@ekryski ekryski added this to the 0.7 milestone Mar 28, 2016
@ekryski ekryski closed this as completed Mar 30, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants