Skip to content

Commit

Permalink
updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Wemyss committed Dec 19, 2017
1 parent d247985 commit 142401f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ const someAsynchronousFunction = async () => {
}
const someOtherAction = async () => {
const result = await someAsynchronousFunction();
//result = {error:{message: 'something went wrong while doing something else', err: Error}}
if(result.error) return result; //pass error back up the stack
doSomethingWith(result);
}
```
This library also has the ability to pass status codes along with the error:
`errorHandler.errorFormatter('something went wrong', new Error('I am an error'), 401);`
will return `{error: {message: 'I am an error', err: Error, 401 }}`.

This project is still under development, so if you see anything broken please write an issue. Better yet, send me a pull request.


0 comments on commit 142401f

Please sign in to comment.