code: function wrapCBMiddleware(handler, action) {
  		// Merge action option and broker options
  		const opts = Object.assign({}, this.options.circuitBreaker || {}, action.circuitBreaker || {});
  		if (opts.enabled) {
  			return function circuitBreakerMiddleware(ctx) {
  				// Get endpoint state item
  				const ep = ctx.endpoint;
  				const item = getEpState(ep, opts);
  
  				// Handle half-open state in circuit breaker
  				if (item.state == C.CIRCUIT_HALF_OPEN) {
  					halfOpenWait(item, ctx);
  				}
  
  				// Call the handler
  				return handler(ctx).then(res => {
  					const item = getEpState(ep, opts);
  					success(item, ctx);
  
  					return res;
  				}).catch(err => {
  					if (opts.check && opts.check(err)) {
  						// Failure if error is created locally (not came from a 3rd node error)
  						if (item && (!err.nodeID || err.nodeID == ctx.nodeID)) {
  							const item = getEpState(ep, opts);
  							failure(item, err, ctx);
  						}
  					}
  
  					return this.Promise.reject(err);
  				});
  			}.bind(this);
  		}
  
  		return handler;
  	}
docs: Middleware wrapper function
  
  @param {Function} handler
  @param {Action} action
  @returns {Function}