Skip to content

Commit

Permalink
refactor(function-tree): improve error message on missing promise or …
Browse files Browse the repository at this point in the history
…path
  • Loading branch information
gaspard committed Dec 17, 2016
1 parent 5b8ecb8 commit 24c26a1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions packages/function-tree/src/FunctionTree.test.js
Expand Up @@ -172,7 +172,7 @@ describe('FunctionTree', () => {
})
})
})
it('should give error when path and no path returned', () => {
it('should give error when path and no path returned', (done) => {
function actionA () {
return {
foo: 'bar'
Expand All @@ -185,8 +185,9 @@ describe('FunctionTree', () => {
success: []
}
]
execute.once('error', () => {
assert.ok(true)
execute.once('error', (error) => {
assert.ok(error.message.match(/needs to be a path or a Promise/))
done()
})
execute(tree)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/function-tree/src/index.js
Expand Up @@ -116,7 +116,7 @@ class FunctionTreeExecution extends EventEmitter {
functionTree.emit('functionEnd', execution, funcDetails, payload)
next(result.toJS())
} else if (funcDetails.outputs) {
let error = new Error('The result ' + JSON.stringify(result) + ' from function ' + funcDetails.name + ' needs to be a path')
let error = new Error('The result ' + JSON.stringify(result) + ' from function ' + funcDetails.name + ' needs to be a path or a Promise')

errorCallback(error)
} else if (isValidResult(result)) {
Expand Down

0 comments on commit 24c26a1

Please sign in to comment.