Skip to content

Commit

Permalink
Return catch function result to the next step.
Browse files Browse the repository at this point in the history
Closes #135.

File                             Raw         Min         Zip     Min/Zip
index.js                 15697/15.33  5465/05.34  3401/03.32  1970/01.92
  • Loading branch information
flatheadmill committed Jul 10, 2013
1 parent 7f7dd6d commit defd607
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -922,6 +922,7 @@ Changes for each release.
### Version 0.0.22
* Catch functions to not return their results to the next step. #135.
* Implement loop labels. #131.
* Aways flatten callback arguments. #133.
Expand Down
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -73,7 +73,7 @@ function cadence () {
return caught
})
if (!errors.uncaught) {
step[step.length - 1].call(this, errors, errors[0])
return step[step.length - 1].call(this, errors, errors[0])
} else {
throw errors
}
Expand Down Expand Up @@ -330,7 +330,7 @@ function cadence () {
arguments[1] = previous.finalizers
callback.apply(this, __slice.call(arguments))
} else {
//previous.callbacks = argue(__slice.call(arguments, 2))
previous.callbacks = argue(__slice.call(arguments, 2))
invoke.apply(previous.self, previous.args)
}
})
Expand Down
4 changes: 1 addition & 3 deletions t/cadence/errors.t.js
@@ -1,6 +1,6 @@
#!/usr/bin/env node

require('proof')(19, function (equal, ok) {
require('proof')(20, function (equal, ok) {
var fs = require('fs')
var cadence = require('../..')
var errors = []
Expand Down Expand Up @@ -63,15 +63,13 @@ require('proof')(19, function (equal, ok) {
equal(errors[0].message, "handled", "condtionally caught regex")
}])()

/* FAILING
cadence([function (step) {
throw new Error
}, function (error) {
return 1
}], function (number) {
equal(number, 1, 'handled and value changed')
})()
*/

cadence([function (step) {
var error = new Error("handled")
Expand Down

0 comments on commit defd607

Please sign in to comment.