Merge pull request #947 from m0hamed/fix/exception_without_name

Exceptions without a name may get a name extracted out of the message
This commit is contained in:
Michal Čihař 2014-02-19 09:51:43 +01:00
commit b71192c5d9

View File

@ -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
*