Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
fix(common): Catch - fixed for async functions (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiisol authored Mar 6, 2017
1 parent 4b36bd0 commit 4ebd13f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Common#1.1.1
* Fix for **@Catch()** to provide proper arguments if original function returns Promise (async function)

# Common#1.1.0
* Moved project back to es5
* **@Catch()** now accepts all passed arguments of the original function and error, e.g.:
Expand Down
2 changes: 1 addition & 1 deletion common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@decorators/common",
"version": "1.1.0",
"version": "1.1.1",
"description": "node decorators",
"main": "src/index.js",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion common/src/catch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function Catch(catchFn: Function) {
try {
let value = originalMethod.apply(this, args);
if (value !== undefined && value.catch) {
value.catch(catchFn);
value.catch(error => catchFn(...args, error));
}
return value;
} catch (error) {
Expand Down

0 comments on commit 4ebd13f

Please sign in to comment.