Browse Source

Log IDB debug info on error

Thibaut Courouble 9 years ago
parent
commit
7467395c33
2 changed files with 4 additions and 1 deletions
  1. 3 1
      assets/javascripts/app/app.coffee
  2. 1 0
      assets/javascripts/app/db.coffee

+ 3 - 1
assets/javascripts/app/app.coffee

@@ -57,7 +57,9 @@
             mode: if @DOC then 'single' else 'full'
             mode: if @DOC then 'single' else 'full'
             iframe: (window.top isnt window).toString()
             iframe: (window.top isnt window).toString()
           dataCallback: (data) ->
           dataCallback: (data) ->
-            try $.extend(data.user ||= {}, app.settings.settings)
+            try
+              $.extend(data.user ||= {}, app.settings.settings)
+              data.user.lastIDBTransaction = app.lastIDBTransaction if app.lastIDBTransaction
             data
             data
         .install()
         .install()
       @previousErrorHandler = onerror
       @previousErrorHandler = onerror

+ 1 - 0
assets/javascripts/app/db.coffee

@@ -244,6 +244,7 @@ class app.DB
     @useIndexedDB and (not @cachedDocs or @cachedDocs[entry.doc.slug])
     @useIndexedDB and (not @cachedDocs or @cachedDocs[entry.doc.slug])
 
 
   idbTransaction: (db, options) ->
   idbTransaction: (db, options) ->
+    app.lastIDBTransaction = [options.stores, options.mode]
     txn = db.transaction(options.stores, options.mode)
     txn = db.transaction(options.stores, options.mode)
     unless options.ignoreError is false
     unless options.ignoreError is false
       txn.onerror = (event) ->
       txn.onerror = (event) ->