wrappedCallback = function(value) {
            try {
              result.resolve((isFunction(callback) ? callback : defaultCallback)(value));
            } catch(e) {
              result.reject(e);
              exceptionHandler(e);
            }
          }
@ngdoc method
@name $q#defer
@function

@description
Creates a `Deferred` object which represents a task which will finish in the future.

@returns {Deferred} Returns a new instance of deferred.