diff --git a/src/providers/indexeddb.js b/src/providers/indexeddb.js index 2658163..4975d60 100644 --- a/src/providers/indexeddb.js +++ b/src/providers/indexeddb.js @@ -9,6 +9,7 @@ define(function(require) { var IDB_RW = require('src/constants').IDB_RW; var IDB_RO = require('src/constants').IDB_RO; + var Errors = require('src/errors'); function IndexedDBContext(db, mode) { var transaction = db.transaction(FILE_STORE_NAME, mode); @@ -112,7 +113,7 @@ define(function(require) { callback(null, firstAccess); }; openRequest.onerror = function onerror(error) { - callback(error); + callback(new Errors.EINVAL('IndexedDB cannot be accessed. If private browsing is enabled, disable it.')); }; }; IndexedDB.prototype.getReadOnlyContext = function() { diff --git a/src/providers/websql.js b/src/providers/websql.js index 4101de1..c765f8a 100644 --- a/src/providers/websql.js +++ b/src/providers/websql.js @@ -5,6 +5,7 @@ define(function(require) { var WSQL_SIZE = require('src/constants').WSQL_SIZE; var WSQL_DESC = require('src/constants').WSQL_DESC; var u8toArray = require('src/shared').u8toArray; + var Errors = require('src/errors'); function WebSQLContext(db, isReadOnly) { var that = this; @@ -116,6 +117,9 @@ define(function(require) { } function onError(transaction, error) { + if (error.code === 5) { + callback(new Errors.EINVAL('WebSQL cannot be accessed. If private browsing is enabled, disable it.')); + } callback(error); } function onSuccess(transaction, result) {