 
   scratch = test.scratch @
 
-  describe 'sync', ->
+  describe 'handler', ->
 
     it 'register actions in callback', (next) ->
       msgs = []

          content.should.eql 'abcdefhij'
          next()

    it 'handler errors in handler', (next) ->
      m = mecano()
      m.register 'anaction', (options, callback) ->
        throw Error 'Catchme'
      m
      .anaction
        key: "value"
      , (err, written) ->
        err.message.should.eql 'Catchme'
      .then (err, changed) ->
        err.message.should.eql 'Catchme'
        next()

    it 'handler errors in callback', (next) ->
      # msgs = []
      # m = mecano log: (msg) -> msgs.push msg if /\/file_\d/.test msg
      mecano()

      .then (err, changed) ->
        err.message.should.eql 'Catchme'
        next()

  describe 'error', ->

    it 'throw in sync action', (next) ->
      m = mecano()
      m.register 'anaction', (options, callback) ->
        throw Error 'Catchme'
      m
      .anaction
        key: "value"
      , (err, written) ->
        err.message.should.eql 'Catchme'
      .then (err, changed) ->
        err.message.should.eql 'Catchme'
        next()

    it 'throw in async action', (next) ->
      m = mecano()
      m.register 'anaction', (options, callback) ->
        setImmediate -> callback Error 'Catchme'
      m
      .anaction
        key: "value"
      , (err, written) ->
        err.message.should.eql 'Catchme'
      .then (err, changed) ->
        err.message.should.eql 'Catchme'
        next()
