diff --git a/debian/changelog b/debian/changelog index 9d56e766..3ff09a22 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (1.207-1) stable; urgency=low +hedera-web (1.208-1) stable; urgency=low * Initial Release. diff --git a/lib/vn/hedera/init.php b/lib/vn/hedera/init.php index ca24a58f..cddca06c 100644 --- a/lib/vn/hedera/init.php +++ b/lib/vn/hedera/init.php @@ -10,4 +10,8 @@ if (!defined (__NAMESPACE__.'\_DEVELOPER_MODE')) require_once (_CONFIG_DIR .'/config.php'); +ini_set ('log_errors', TRUE); +ini_set ('error_log', 'syslog'); +//ini_set ('error_log', _LOG_DIR .'/hedera-web.log'); + ?> diff --git a/lib/vn/tpv/tpv.php b/lib/vn/tpv/tpv.php index 083bfc28..7f29a495 100755 --- a/lib/vn/tpv/tpv.php +++ b/lib/vn/tpv/tpv.php @@ -19,9 +19,8 @@ class Tpv { global $conf; - ini_set ('log_errors', TRUE); - ini_set ('error_log', Hedera\_LOG_DIR .'/hedera-web.log'); - + openlog ('hedera-web', LOG_ODELAY, LOG_LOCAL0); + self::$conn = new Db\Conn (); self::$conn->open ( $conf['db']['host'] @@ -37,6 +36,7 @@ class Tpv static function deinit () { self::$conn->close (); + closelog (); } /** diff --git a/web/index.php b/web/index.php index 50f4411b..09e749af 100755 --- a/web/index.php +++ b/web/index.php @@ -1,5 +1,7 @@ getFile () .':'. $e->getLine () .': '. $e->getMessage ()); + error_log (sprintf ('Exception: %s(%d): %s. Trace: %s' + ,$e->getFile () + ,$e->getLine () + ,$e->getMessage () + ,$e->getTraceAsString () + )); myGlobalErrorHandler (); } diff --git a/web/js/db/conn.js b/web/js/db/conn.js index fd325f9e..8ec75641 100755 --- a/web/js/db/conn.js +++ b/web/js/db/conn.js @@ -180,6 +180,7 @@ Db.Conn.implement */ ,execDone: function (httpRequest, callback, success) { + var e; var error = null; var results = null; @@ -189,7 +190,10 @@ Db.Conn.implement this.signalEmit ('loading-changed', false); if (!success) - error = new Vn.Error ('Http', 'connError', _('ConnError')); + { + error = new Vn.Error ('Conn', 'connError', _('ConnError')); + this.signalEmit ('error', error); + } else try { var json = httpRequest.getJson (); @@ -231,17 +235,20 @@ Db.Conn.implement } } } - catch (e) { - error = new Vn.Error ('Http', 'badReply', e.message); + catch (e) + { + this.signalEmit ('error', e); + error = e; } - - var errorHandled = false; if (callback) - errorHandled = callback (new Db.ResultSet (results, error)); - - if (error && errorHandled != true) - this.signalEmit ('error', error); + try { + callback (new Db.ResultSet (results, error)); + } + catch (e) + { + this.signalEmit ('error', e); + } } }); diff --git a/web/js/vn/http-request.js b/web/js/vn/http-request.js index 9daa890b..2c47b24a 100755 --- a/web/js/vn/http-request.js +++ b/web/js/vn/http-request.js @@ -19,7 +19,7 @@ Vn.HttpRequest = new Class ,requestStateChanged: function (callback) { - if (this.request.readyState == 4) + if (this.request.readyState == 4 && callback) callback (this, this.request.status == 200); } diff --git a/web/log.php b/web/log.php new file mode 100755 index 00000000..e61a66b0 --- /dev/null +++ b/web/log.php @@ -0,0 +1,20 @@ + diff --git a/web/pages/update-browser/style.css b/web/pages/update-browser/style.css index 74c874c8..c2fcdc9c 100755 --- a/web/pages/update-browser/style.css +++ b/web/pages/update-browser/style.css @@ -5,22 +5,22 @@ img { position: absolute; - margin-top: -18em; - margin-left: -18em; + margin-top: -200px; + margin-left: -200px; top: 50%; left: 50%; } #continue { position: absolute; - bottom: 0px; - left: 0px; - right: 0px; - margin: 15px; + bottom: 0; + left: 0; + right: 0; + margin: 1em; text-align: center; } a { color: #444; - border-width: 0px; + border-width: 0; } diff --git a/web/pages/web/web.js b/web/pages/web/web.js index 2e8b8cb1..25429f05 100755 --- a/web/pages/web/web.js +++ b/web/pages/web/web.js @@ -14,6 +14,11 @@ Vn.Web = ,initialize: function () { + window.onerror = function (error, a, b, c, d) + { + this.errorHandler.bind (this, error); + }.bind (this); + this.loadingCount = 0; this.loader = $('loader'); this.formHolder = $('form-holder'); @@ -157,8 +162,9 @@ Vn.Web = this.onFormChange (); } - ,onConnError: function (conn, error) + ,errorHandler: function (error) { + if (error instanceof Vn.Error) switch (error.domain) { case 'Auth': @@ -172,9 +178,29 @@ Vn.Web = Htk.Toast.showError (error.message); break; default: - console.warn (error.message); + console.error (error.message); Htk.Toast.showError (_('InternalError')); } + else + { + console.error (error); + Htk.Toast.showError (_('InternalError')); + + var httpRequest = new Vn.HttpRequest () + httpRequest.add + ({ + 'file': error.fileName + ,'line': error.lineNumber + ,'message': error.message + ,'stack': error.stack + }); + httpRequest.send ('log.php'); + } + } + + ,onConnError: function (conn, error) + { + this.errorHandler (error); } ,onConnLoading: function (conn, isLoading) @@ -206,8 +232,10 @@ Vn.Web = ,newVersion: function (error) { - if (this.skipVersion) + if (this.newVersionBlock || this.skipVersion) return; + + this.newVersionBlock = true; var reload; var message = _('NewVersionAvailable') +"\n\n"+ error.message; @@ -228,6 +256,8 @@ Vn.Web = this.unload (); location.reload (); } + + this.newVersionBlock = false; } ,createMenu: function (res, sectionMap, parent, ul) @@ -426,7 +456,7 @@ Vn.Web = } catch (e) { formInfo.error = true; - console.error (e); + this.errorHandler (error); } } else diff --git a/web/rest.php b/web/rest.php index 0a587041..f20207f3 100755 --- a/web/rest.php +++ b/web/rest.php @@ -1,5 +1,7 @@ getFile () .':'. $e->getLine () .': '. $e->getMessage ()); + error_log (sprintf ('Exception: %s(%d): %s. Trace: %s' + ,$e->getFile () + ,$e->getLine () + ,$e->getMessage () + ,$e->getTraceAsString () + )); myGlobalErrorHandler (); }