resolve = function resolve(result, onFulfilled, onRejected, context) {
        if (typeof result === 'function') {
            this.isExecuted = true;
            result = result.call(this);
        }

        /**
         * run error handler if command fails
         */
        if (result instanceof Error) {
            var _result = result;

            this.defer.resolve(_promise2.default.all(_errorHandler2.default.map(function (fn) {
                return fn.call(context, result);
            })).then(function (res) {
                var handlerResponses = res.filter(function (r) {
                    return typeof r !== 'undefined';
                });

                /**
                 * if no handler was triggered then throw actual error
                 */
                if (handlerResponses.length === 0) {
                    return callErrorHandlerAndReject.call(context, _result, onRejected);
                }

                return onFulfilled.call(context, handlerResponses[0]);
            }, function (e) {
                return callErrorHandlerAndReject.call(context, e, onRejected);
            }));
        } else {
            this.defer.resolve(result);
        }

        return this.promise;
    }
if no caps are specified fall back to firefox