diff --git a/netstack.js b/netstack.js index 6ef8fa8..2bfebfe 100644 --- a/netstack.js +++ b/netstack.js @@ -1,5 +1,5 @@ /*! - * netStack v1.1.0 + * netStack v1.1.1 * A simple and easy jQuery plugin for highlighting .NET stack traces * License : Apache 2 * Author : https://elmah.io @@ -35,7 +35,7 @@ repl: null }, { - find: new RegExp('(\\s*?)'+at_language+' ([^-:]*?)\\((.*?)\\)', 'g'), + find: new RegExp('(\\s)'+at_language+' ([^-:]*?)\\((.*?)\\)', 'g'), repl: null } ] diff --git a/package.json b/package.json index 883123f..0d4fa71 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "netstack.js", - "version": "1.1.0", + "version": "1.1.1", "description": "A simple and easy jQuery plugin for highlighting .NET stack traces", "main": "netstack.js", "scripts": { diff --git a/test/stacktraces.html b/test/stacktraces.html index 248b317..3be21ed 100644 --- a/test/stacktraces.html +++ b/test/stacktraces.html @@ -2,6 +2,7 @@
System.ApplicationException: Runtime error ---> System.FormatException: The input string was not formatted correctly. at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type) at System.Number.ParseInt32(ReadOnlySpan`1 value, NumberStyles styles, NumberFormatInfo info) at System.Int32.Parse(String s) at MyNamespace.IntParser.Execute(String s) in C:\apps\MyNamespace\IntParser.cs:line 13 --- End of stack trace from previous location where exception was thrown --- at Elmah.Io.App.Controllers.AccountController.ChangeEmail(String secret) in x:\agent\_work\94\s\src\Elmah.Io.App\Controllers\AccountController.cs:line 45 at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) --- End of stack trace from previous location where exception was thrown --- at MyNamespace.IntParser.Execute(String s) in C:\apps\MyNamespace\IntParser.cs:line 17 at MyNamespace.Program.Main(String[] args) in C:\apps\MyNamespace\Program.cs:line 13
+ Elmah.TestException: This is a test exception that can be safely ignored. at Elmah.ErrorLogPageFactory.FindHandler(String name) in C:\ELMAH\src\Elmah\ErrorLogPageFactory.cs:line 126 at Elmah.ErrorLogPageFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) in C:\ELMAH\src\Elmah\ErrorLogPageFactory.cs:line 66 at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
System.ApplicationException: Kørselsfejl ---> System.FormatException: Inputstrengen blev ikke formateret korrekt. ved System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type) ved System.Number.ParseInt32(ReadOnlySpan`1 value, NumberStyles styles, NumberFormatInfo info) ved System.Int32.Parse(String s) ved MyNamespace.IntParser.Execute(String s) i C:\apps\MyNamespace\IntParser.cs:linje 13 --- Slutning af stackspor fra tidligere sted, hvor undtagelse blev kastet --- ved Elmah.Io.App.Controllers.AccountController.ChangeEmail(String secret) i x:\agent\_work\94\s\src\Elmah.Io.App\Controllers\AccountController.cs:linje 45 ved System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) --- Slutning af stackspor fra tidligere sted, hvor undtagelse blev kastet --- ved MyNamespace.IntParser.Execute(String s) i C:\apps\MyNamespace\IntParser.cs:linje 17 ved MyNamespace.Program.Main(String[] args) i C:\apps\MyNamespace\Program.cs:linje 13
System.ApplicationException: Etwas hier ---> System.FormatException: Die Eingabezeichenfolge wurde nicht richtig formatiert. bei System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type) bei System.Number.ParseInt32(ReadOnlySpan`1 value, NumberStyles styles, NumberFormatInfo info) bei System.Int32.Parse(String s) bei MyNamespace.IntParser.Execute(String s) in C:\apps\MyNamespace\IntParser.cs:Zeile 13 --- Ende des Stack-Trace vom vorherigen Ort, an dem eine Ausnahme ausgelöst wurde --- bei Elmah.Io.App.Controllers.AccountController.ChangeEmail(String secret) in x:\agent\_work\94\s\src\Elmah.Io.App\Controllers\AccountController.cs:Zeile 45 bei System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) --- Ende des Stack-Trace vom vorherigen Ort, an dem eine Ausnahme ausgelöst wurde --- bei MyNamespace.IntParser.Execute(String s) in C:\apps\MyNamespace\IntParser.cs:Zeile 17 bei MyNamespace.Program.Main(String[] args) in C:\apps\MyNamespace\Program.cs:Zeile 13
System.ApplicationException: Ошибка в ходе выполнения ---> System.FormatException: Входная строка имела неверный формат. в System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type) в System.Number.ParseInt32(ReadOnlySpan`1 value, NumberStyles styles, NumberFormatInfo info) в System.Int32.Parse(String s) в MyNamespace.IntParser.Execute(String s) в C:\apps\MyNamespace\IntParser.cs:строка 13 --- Конец трассировка стека из предыдущего расположения, где возникло исключение --- в Elmah.Io.App.Controllers.AccountController.ChangeEmail(String secret) в x:\agent\_work\94\s\src\Elmah.Io.App\Controllers\AccountController.cs:строка 45 в System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) --- End of stack trace from previous location where exception was thrown --- в MyNamespace.IntParser.Execute(String s) в C:\apps\MyNamespace\IntParser.cs:строка 17 в MyNamespace.Program.Main(String[] args) в C:\apps\MyNamespace\Program.cs:строка 13
diff --git a/test/test.js b/test/test.js
index 00d3181..ccc3f5a 100644
--- a/test/test.js
+++ b/test/test.js
@@ -11,10 +11,9 @@ const body = window.document.body;
describe('netstack.js', function() {
describe('stacktrace test', function() {
- describe('> English', function() {
+ describe('> English I', function() {
const elementEN = $('body').find('.stacktrace-en')[0];
const stackElementEN = $(elementEN).netStack({ prettyprint: true });
- const stringEN = stackElementEN.getJSON();
const languageEN = stackElementEN.getLanguage();
const stringStack = "System.ApplicationException: Runtime error ---> System.FormatException: The input string was not formatted correctly.\n at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)\n at System.Number.ParseInt32(ReadOnlySpan`1 value, NumberStyles styles, NumberFormatInfo info)\n at System.Int32.Parse(String s)\n at MyNamespace.IntParser.Execute(String s) in C:\\apps\\MyNamespace\\IntParser.cs:line 13 \n --- End of stack trace from previous location where exception was thrown ---\n at Elmah.Io.App.Controllers.AccountController.ChangeEmail(String secret) in x:\\agent\\_work\\94\\s\\src\\Elmah.Io.App\\Controllers\\AccountController.cs:line 45\n at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) \n --- End of stack trace from previous location where exception was thrown ---\n at MyNamespace.IntParser.Execute(String s) in C:\\apps\\MyNamespace\\IntParser.cs:line 17\n at MyNamespace.Program.Main(String[] args) in C:\\apps\\MyNamespace\\Program.cs:line 13";
@@ -26,10 +25,23 @@ describe('netstack.js', function() {
});
});
+ describe('> English II', function() {
+ const elementEN = $('body').find('.stacktrace-en-2')[0];
+ const stackElementEN = $(elementEN).netStack({ prettyprint: true });
+ const languageEN = stackElementEN.getLanguage();
+ const stringStack = "Elmah.TestException: This is a test exception that can be safely ignored.\n at Elmah.ErrorLogPageFactory.FindHandler(String name) in C:\\ELMAH\\src\\Elmah\\ErrorLogPageFactory.cs:line 126\n at Elmah.ErrorLogPageFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) in C:\\ELMAH\\src\\Elmah\\ErrorLogPageFactory.cs:line 66\n at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)\n at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()\n at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)";
+
+ it('-> recognize language', function() {
+ assert.equal('english', languageEN);
+ });
+ it('-> create HTML', function() {
+ assert.equal(stringStack, $(stackElementEN).html());
+ });
+ });
+
describe('> Danish', function() {
const elementDK = $('body').find('.stacktrace-dk')[0];
const stackElementDK = $(elementDK).netStack({ prettyprint: true });
- const stringDK = stackElementDK.getJSON();
const languageDK = stackElementDK.getLanguage();
const stringStack = "System.ApplicationException: Kørselsfejl ---> System.FormatException: Inputstrengen blev ikke formateret korrekt.\n ved System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)\n ved System.Number.ParseInt32(ReadOnlySpan`1 value, NumberStyles styles, NumberFormatInfo info)\n ved System.Int32.Parse(String s)\n ved MyNamespace.IntParser.Execute(String s) i C:\\apps\\MyNamespace\\IntParser.cs:linje 13 \n --- Slutning af stackspor fra tidligere sted, hvor undtagelse blev kastet ---\n ved Elmah.Io.App.Controllers.AccountController.ChangeEmail(String secret) i x:\\agent\\_work\\94\\s\\src\\Elmah.Io.App\\Controllers\\AccountController.cs:linje 45\n ved System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) \n --- Slutning af stackspor fra tidligere sted, hvor undtagelse blev kastet ---\n ved MyNamespace.IntParser.Execute(String s) i C:\\apps\\MyNamespace\\IntParser.cs:linje 17\n ved MyNamespace.Program.Main(String[] args) i C:\\apps\\MyNamespace\\Program.cs:linje 13";
@@ -44,7 +56,6 @@ describe('netstack.js', function() {
describe('> German', function() {
const elementDE = $('body').find('.stacktrace-de')[0];
const stackElementDE = $(elementDE).netStack({ prettyprint: true });
- const stringDE = stackElementDE.getJSON();
const languageDE = stackElementDE.getLanguage();
const stringStack = "System.ApplicationException: Etwas hier ---> System.FormatException: Die Eingabezeichenfolge wurde nicht richtig formatiert.\n bei System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)\n bei System.Number.ParseInt32(ReadOnlySpan`1 value, NumberStyles styles, NumberFormatInfo info)\n bei System.Int32.Parse(String s)\n bei MyNamespace.IntParser.Execute(String s) in C:\\apps\\MyNamespace\\IntParser.cs:Zeile 13 \n --- Ende des Stack-Trace vom vorherigen Ort, an dem eine Ausnahme ausgelöst wurde ---\n bei Elmah.Io.App.Controllers.AccountController.ChangeEmail(String secret) in x:\\agent\\_work\\94\\s\\src\\Elmah.Io.App\\Controllers\\AccountController.cs:Zeile 45\n bei System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) \n --- Ende des Stack-Trace vom vorherigen Ort, an dem eine Ausnahme ausgelöst wurde ---\n bei MyNamespace.IntParser.Execute(String s) in C:\\apps\\MyNamespace\\IntParser.cs:Zeile 17\n bei MyNamespace.Program.Main(String[] args) in C:\\apps\\MyNamespace\\Program.cs:Zeile 13";
@@ -59,7 +70,6 @@ describe('netstack.js', function() {
describe('> Russian', function() {
const elementRU = $('body').find('.stacktrace-ru')[0];
const stackElementRU = $(elementRU).netStack({ prettyprint: true });
- const stringRU = stackElementRU.getJSON();
const languageRU = stackElementRU.getLanguage();
const stringStack = "System.ApplicationException: Ошибка в ходе выполнения ---> System.FormatException: Входная строка имела неверный формат.\n в System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)\n в System.Number.ParseInt32(ReadOnlySpan`1 value, NumberStyles styles, NumberFormatInfo info)\n в System.Int32.Parse(String s)\n в MyNamespace.IntParser.Execute(String s) в C:\\apps\\MyNamespace\\IntParser.cs:строка 13 \n --- Конец трассировка стека из предыдущего расположения, где возникло исключение ---\n в Elmah.Io.App.Controllers.AccountController.ChangeEmail(String secret) в x:\\agent\\_work\\94\\s\\src\\Elmah.Io.App\\Controllers\\AccountController.cs:строка 45\n в System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength) \n --- End of stack trace from previous location where exception was thrown ---\n в MyNamespace.IntParser.Execute(String s) в C:\\apps\\MyNamespace\\IntParser.cs:строка 17\n в MyNamespace.Program.Main(String[] args) в C:\\apps\\MyNamespace\\Program.cs:строка 13";