Skip to content

Commit

Permalink
+version and context to interceptors
Browse files Browse the repository at this point in the history
  • Loading branch information
willguitaradmfar committed Oct 15, 2018
1 parent 6a7a5bd commit 984a226
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cdi-node",
"version": "0.0.12",
"version": "0.0.13",
"description": "",
"main": "src/index.js",
"index": "src/index.js",
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = class CDI {
get: (_obj, _prop) => {
if (!_obj[_prop]) return

if (typeof _obj[_prop] === 'function') return this.interceptorsVariable[_prop](prop, arg)
if (typeof _obj[_prop] === 'function') return this.interceptorsVariable[_prop].call(ctx, prop, arg)

return _obj[_prop]
}
Expand All @@ -62,13 +62,13 @@ module.exports = class CDI {
const response = await obj[prop].call(ctx, resolveInterceptor)

if (this.interceptorDone) {
return this.interceptorDone(response, prop, arg)
return this.interceptorDone.call(ctx, response, prop, arg)
}

return response
} catch (err) {
if (this.interceptorCatch) {
return this.interceptorCatch(err, prop, arg)
return this.interceptorCatch.call(ctx, err, prop, arg)
}
throw err
}
Expand Down

0 comments on commit 984a226

Please sign in to comment.