specs for middleware, call cleanup on error if no onError is provided
release 0.3.0