From f40360c5671fd0a8b21e7693c9ea444fafff3123 Mon Sep 17 00:00:00 2001 From: Mohamed Ashraf Date: Tue, 18 Feb 2014 17:54:03 +0200 Subject: [PATCH] Exceptions without a name may get a name extracted out of the message Signed-off-by: Mohamed Ashraf --- js/error_report.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/js/error_report.js b/js/error_report.js index c3765304d0..c52dc7bbda 100644 --- a/js/error_report.js +++ b/js/error_report.js @@ -15,6 +15,9 @@ var ErrorReport = { * @return void */ error_handler: function (exception) { + if (exception.name === null || typeof(exception.name) == "undefined") { + exception.name = ErrorReport._extractExceptionName(exception); + } ErrorReport._last_exception = exception; $.get("error_report.php", { ajax_request: true, @@ -151,6 +154,18 @@ var ErrorReport = { $(this).remove(); }); }, + /** + * Extracts Exception name from message if it exists + * + * @return String + */ + _extractExceptionName: function (exception) { + if (exception.message === null || typeof(exception.message) == "undefined"){ + return ""; + } else { + return (/([a-zA-Z]+):/).exec(exception.message)[1]; + } + }, /** * Shows the modal dialog previewing the report *