> For the complete documentation index, see [llms.txt](https://feathersjs-mongoose.gitbook.io/feathers-mongoose-casl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://feathersjs-mongoose.gitbook.io/feathers-mongoose-casl/version-2-support-feathers-4/docs/start-new-project-1/update-app.hook.md).

# App hooks

* Add **hook.errorHandler** to make sure that errors get cleaned up before they go back to the client

### &#x20;Open src\app.hooks.js and paste this

{% code title="src\app.hooks.js" %}

```javascript
const {hooks} = require('feathers-mongoose-casl');

module.exports = {
  before: {
    all: [],
    find: [],
    get: [],
    create: [],
    update: [],
    patch: [],
    remove: []
  },

  after: {
    all: [],
    find: [],
    get: [],
    create: [],
    update: [],
    patch: [],
    remove: []
  },

  error: {
    all: [hooks.errorHandler() ], // errorHandler - make sure that errors get cleaned up before they go back to the client
    find: [],
    get: [],
    create: [],
    update: [],
    patch: [],
    remove: []
  }
};
```

{% endcode %}

```
git add .
git commit -m "Add feathers-mongoose-casl authentication and authorization hooks"
```
