From fec18f39d932ac2a3f2109a6fb4349643bfc33c7 Mon Sep 17 00:00:00 2001 From: Kyle Utecht Date: Thu, 4 Sep 2014 10:30:59 -0500 Subject: [PATCH] truncates long queries in error pop-up to keep 'ok' button on screen Updated chrome/resoure/sqlite.js onSqlError function to limit restatement of SQL query to only first 10 lines for long queries so that the bottom of the alert pop-up stays on screen. A '...' is appended to the end of truncated queries. Other error information on the pop-up is left alone. --- sqlite-manager/chrome/resource/sqlite.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sqlite-manager/chrome/resource/sqlite.js b/sqlite-manager/chrome/resource/sqlite.js index d6ff5d4..194dcf1 100755 --- a/sqlite-manager/chrome/resource/sqlite.js +++ b/sqlite-manager/chrome/resource/sqlite.js @@ -1071,6 +1071,11 @@ SQLiteHandler.prototype = { }, onSqlError: function(ex, msg, SQLmsg, bAlert) { + var startOfMessage + if (msg.search(/(.*\n){10,}/) > -1) { + // msg is more than 10 lines long + msg = /(.*\n?){1,10}/.exec(msg)[0] + '...'; + } msg = "SQLiteManager: " + msg; if (SQLmsg != null) msg += " [ " + SQLmsg + " ]";