Bug 1111284 - Improve error messages of Sqlite.jsm by including specific error message. r=Yoric
authorJacob Clark <jacob.jh.clark@googlemail.com>
Sun, 14 Dec 2014 21:26:31 +0000
changeset 245713 97af67305dabd4735801c4c0e54e3deb6fa2d588
parent 245712 8da5ef05e40a90fe6d3de0b15a5a5182429f64d6
child 245714 df4c50342efb5af88274829157f4a0be83ec730e
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs1111284
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1111284 - Improve error messages of Sqlite.jsm by including specific error message. r=Yoric
toolkit/modules/Sqlite.jsm
toolkit/modules/tests/xpcshell/test_sqlite.js
--- a/toolkit/modules/Sqlite.jsm
+++ b/toolkit/modules/Sqlite.jsm
@@ -677,17 +677,17 @@ ConnectionData.prototype = Object.freeze
               deferred.resolve(result);
             } else {
               deferred.reject(new Error("Statement was cancelled."));
             }
 
             break;
 
           case Ci.mozIStorageStatementCallback.REASON_ERROR:
-            let error = new Error("Error(s) encountered during statement execution.");
+            let error = new Error("Error(s) encountered during statement execution: " + [error.message for (error of errors)].join(", "));
             error.errors = errors;
             deferred.reject(error);
             break;
 
           default:
             deferred.reject(new Error("Unknown completion reason code: " +
                                       reason));
             break;
--- a/toolkit/modules/tests/xpcshell/test_sqlite.js
+++ b/toolkit/modules/tests/xpcshell/test_sqlite.js
@@ -928,20 +928,19 @@ add_task(function* test_clone() {
 add_task(function* test_readOnly_clone() {
   let path = OS.Path.join(OS.Constants.Path.profileDir, "test_readOnly_clone.sqlite");
   let c = yield Sqlite.openConnection({path: path, sharedMemoryCache: false});
 
   let clone = yield c.clone(true);
   // Just check that it works.
   yield clone.execute("SELECT 1");
   // But should not be able to write.
-  try {
-    yield clone.execute("CREATE TABLE test (id INTEGER PRIMARY KEY)");
-    do_throw(new Error("Should not be able to write to a read-only clone."));
-  } catch (ex) {}
+
+  yield Assert.rejects(clone.execute("CREATE TABLE test (id INTEGER PRIMARY KEY)"),
+                       /readonly/);
   // Closing order should not matter.
   yield c.close();
   yield clone.close();
 });
 
 // Test Sqlite.wrapStorageConnection.
 add_task(function* test_wrapStorageConnection() {
   let file = new FileUtils.File(OS.Path.join(OS.Constants.Path.profileDir,