How to use the TypeError function from bluebird

Find comprehensive JavaScript bluebird.TypeError code examples handpicked from public code repositorys.

1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
    var fn;
    if (obj != null) fn = obj[methodName];
    if (typeof fn !== "function") {
        var message = "Object " + util.classString(obj) + " has no method '" +
            util.toString(methodName) + "'";
        throw new Promise.TypeError(message);
    }
    return fn;
}

fork icon3
star icon16
watch icon0

3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
var util = _dereq_("./util.js");
var tryCatch = util.tryCatch;


Promise.method = function (fn) {
    if (typeof fn !== "function") {
        throw new Promise.TypeError("fn must be a function\u000a\u000a    See http://goo.gl/916lJJ\u000a");
    }
    return function () {
        var ret = new Promise(INTERNAL);
        ret._captureStackTrace();
fork icon2
star icon11
watch icon0

+ 11 other calls in file

3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
this._values = values;
values._setBoundTo(this._promise._boundTo);
if (values.isFulfilled()) {
    values = values._settledValue;
    if (!isArray(values)) {
        var err = new Promise.TypeError("expecting an array, a promise or a thenable");
        this.__hardReject__(err);
        return;
    }
} else if (values.isPending()) {
fork icon1
star icon2
watch icon1

+ 3 other calls in file