code: function promiseWithError( err, callback) {
          var deferred = Q.defer();
          if ( err instanceof Error ) {
              deferred.reject( err);
          } else {
              deferred.reject(new Error(err));
          }
          if ( typeof callback === 'function' ) {
              callback(err, null);
          }
          return deferred.promise;
      }
docs: Creates a promise that only returns an error to be used when promise is expected
  but an error is already known and calls the callback if given
  @param err - the error object or message as a string
  @param callback - optional, a callback with signature function( error, result).
  if given this one will be called despite returning a promise
  @returns {*|promise} - the promise