###
coffee -cb /opt/node/bb/dev/node_modules/atbar/atbar.cof
coffee -cb /opt/node/bb/dev/node_modules/atbar/tests/arg-error.cof
###

atbar = require('atbar')
atbar.options = 'trace'

badFunc = (cb, bad) -> 
	setTimeout -> 
		if bad then cb 'I am an error msg', null
		else cb null, 'I am good results data'
	, 2000

atbar.run -> 
	@_ -> badFunc @$(), false
	@_ (_err, resp) -> console.log 'resp: ' + resp; @$()()
	@_ -> badFunc @$(), true
	@_ (_err, resp) -> console.log 'should not see this' + resp; @$()()
, (args...) -> console.log 'atbar final callback: ' + JSON.stringify args 
