Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capture a rejected deviceReady correctly #16

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion dist/localforage-cordovasqlitedriver.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ var deviceReady = new Promise(function (resolve, reject) {
}
});

var openDatabasePromise = deviceReady.catch(Promise.resolve).then(function () {
var openDatabasePromise = deviceReady.then(function () {
return new Promise(function (resolve, reject) {
if (typeof sqlitePlugin !== 'undefined' && typeof sqlitePlugin.openDatabase === 'function') {
resolve(sqlitePlugin.openDatabase);
} else {
reject('SQLite plugin is not present.');
}
});
}).catch(function () {
return Promise.resolve();
});

// // If cordova is not present, we can stop now.
Expand Down
4 changes: 3 additions & 1 deletion dist/localforage-cordovasqlitedriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@
}
});

var openDatabasePromise = deviceReady.catch(Promise.resolve).then(function () {
var openDatabasePromise = deviceReady.then(function () {
return new Promise(function (resolve, reject) {
if (typeof sqlitePlugin !== 'undefined' && typeof sqlitePlugin.openDatabase === 'function') {
resolve(sqlitePlugin.openDatabase);
} else {
reject('SQLite plugin is not present.');
}
});
}).catch(function () {
return Promise.resolve();
});

// // If cordova is not present, we can stop now.
Expand Down
4 changes: 3 additions & 1 deletion lib/cordova-sqlite.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var deviceReady = new Promise(function(resolve, reject) {
}
});

export var openDatabasePromise = deviceReady.catch(Promise.resolve).then(function() {
export var openDatabasePromise = deviceReady.then(function() {
return new Promise(function(resolve, reject) {
if (typeof sqlitePlugin !== 'undefined' &&
typeof sqlitePlugin.openDatabase === 'function') {
Expand All @@ -22,4 +22,6 @@ export var openDatabasePromise = deviceReady.catch(Promise.resolve).then(functio
reject('SQLite plugin is not present.');
}
});
}).catch(function() {
return Promise.resolve();
});