       .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()


  scratch = test.scratch @

  describe 'sync', ->

    it 'register actions in callback', (next) ->
      msgs = []

          content.should.eql 'abcdefhij'
          next()

    it 'can throw error', (next) ->
      # msgs = []
      # m = mecano log: (msg) -> msgs.push msg if /\/file_\d/.test msg
      mecano()
