archive/v1/util.js
function newError(errorCode, errorMessage) {
		
		var errObj;
		
		if (_.isObject(errorCode)) {
			errObj = errorCode;
		}
		else if (typeof(errorCode) === 'number') {
			errObj = {
				errorCode: errorCode,
			};
			
			if (errorMessage) {
				errObj.message = errorMessage;
			}
		}
		else {
			errObj = {errorCode: 500};
		}
		
		return new Promise(function(resolve, reject) {
			reject(errObj);
		});
	}
function newError(errorCode, errorMessage) {
		
		var errObj;
		
		if (_.isObject(errorCode)) {
			errObj = errorCode;
		}
		else if (typeof(errorCode) === 'number') {
			errObj = {
				errorCode: errorCode,
			};
			
			if (errorMessage) {
				errObj.message = errorMessage;
			}
		}
		else {
			errObj = {errorCode: 500};
		}
		
		return new Promise(function(resolve, reject) {
			reject(errObj);
		});
	}
function newError ( errorCode , errorMessage ) { var errObj ; if ( _ . isObject ( errorCode ) ) { errObj = errorCode ; } else if ( typeof ( errorCode ) === 'number' ) { errObj = { errorCode : errorCode , } ; if ( errorMessage ) { errObj . message = errorMessage ; } } else { errObj = { errorCode : 500 } ; } return new Promise ( function ( resolve , reject ) { reject ( errObj ) ; } ) ; }
returns a promise that resolves to an error
returns a promise that resolves to an error