src/utils.js
function composeThen(req, res, ...mws) {
	return new Promise((resolve, reject) => {
		compose(...mws)(req, res, err => {
			if (err) {
				/* istanbul ignore next */
				if (err instanceof MoleculerError)
					return reject(err);

				/* istanbul ignore next */
				if (err instanceof Error)
					return reject(new MoleculerError(err.message, err.code || err.status, err.type)); // TODO err.stack

				/* istanbul ignore next */
				return reject(new MoleculerError(err));
			}

			resolve();
		});
	});
}
function composeThen(req, res, ...mws) {
	return new Promise((resolve, reject) => {
		compose(...mws)(req, res, err => {
			if (err) {
				/* istanbul ignore next */
				if (err instanceof MoleculerError)
					return reject(err);

				/* istanbul ignore next */
				if (err instanceof Error)
					return reject(new MoleculerError(err.message, err.code || err.status, err.type)); // TODO err.stack

				/* istanbul ignore next */
				return reject(new MoleculerError(err));
			}

			resolve();
		});
	});
}
function composeThen ( req , res , ... mws ) { return new Promise ( ( resolve , reject ) => { compose ( ... mws ) ( req , res , err => { if ( err ) { /* istanbul ignore next */ if ( err instanceof MoleculerError ) return reject ( err ) ; /* istanbul ignore next */ if ( err instanceof Error ) return reject ( new MoleculerError ( err . message , err . code || err . status , err . type ) ) ; // TODO err.stack /* istanbul ignore next */ return reject ( new MoleculerError ( err ) ) ; } resolve ( ) ; } ) ; } ) ; }
Compose middlewares and return Promise
@param {...Function} mws
@returns {Promise}
Compose middlewares and return Promise