How to use the reject function from when

Find comprehensive JavaScript when.reject code examples handpicked from public code repositorys.

51
52
53
54
55
56
57
58
59
60
try {
    storageModule = moduleSelector(runtime.settings);
    settingsAvailable = storageModule.hasOwnProperty("getSettings") && storageModule.hasOwnProperty("saveSettings");
    sessionsAvailable = storageModule.hasOwnProperty("getSessions") && storageModule.hasOwnProperty("saveSessions");
} catch (e) {
    return when.reject(e);
}
if (!!storageModule.projects) {
    var projectsEnabled = false;
    if (runtime.settings.hasOwnProperty("editorTheme") && runtime.settings.editorTheme.hasOwnProperty("projects")) {
fork icon14
star icon73
watch icon0

+ 4 other calls in file

18
19
20
21
22
23
24
25
26
27
28
Importer000.prototype.importData = function (data) {
    return this.canImport(data)
        .then(function (importerFunc) {
            return importerFunc(data);
        }, function (reason) {
            return when.reject(reason);
        });
};


Importer000.prototype.canImport = function (data) {
fork icon0
star icon0
watch icon0

+ 6 other calls in file