Skip to content

Commit

Permalink
fix exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ZsharE committed Aug 28, 2024
1 parent b512e30 commit 71df3ba
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
15 changes: 11 additions & 4 deletions netstack.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@
};

netStack.prototype.replacer = function(args, at_language) {
if (args[0].substr(0).match(/(-{3})/)) {
if (args[0].substring(0).match(/(-{3}>)/)) {
return '\r\n ' + args[0];
} else if (args[0].substring(0).match(/(-{3})/)) {
return '\r\n ' + args[0];
} else {
return '\r\n ' + at_language + ' ' + args[2] + '(' + args[3] + ')';
Expand All @@ -86,6 +88,10 @@
netStack.prototype.formatException = function(exceptionMessage, at_language) {
var result = exceptionMessage || '';
var searchReplaces = [
{
find: new RegExp('(-{3}>\\s)(.*?)(?=\\s-{3}|(\\s)+' + at_language + ')', 'g'),
repl: null
},
{
find: /(-{3}\s)(.*?)(-{3})/gm,
repl: null
Expand Down Expand Up @@ -158,7 +164,7 @@
var regFrame = new RegExp('(\\S*)' + selectedLanguage.at + ' .*?\\)'),
partsFrame = String(regFrame.exec(lines[i]));

if (partsFrame.substr(partsFrame.length - 1) == ',') {
if (partsFrame.substring(partsFrame.length - 1) == ',') {
partsFrame = partsFrame.slice(0, -1);
}

Expand Down Expand Up @@ -198,8 +204,9 @@
var newPartsFrame = partsFrame.replace(partsParamList, stringParam).replace(partsTypeMethod, stringTypeMethod);

// Line
var regLine = new RegExp('\\b:' + selectedLanguage.line + '.*'),
var regLine = new RegExp('\\b:' + selectedLanguage.line + ' \\d+'),
partsLine = String(regLine.exec(lines[i]));

partsLine = partsLine.replace(':', '').trim();

var fileLi = li.replace(selectedLanguage.at + " " + partsFrame, '').trim();
Expand All @@ -208,7 +215,7 @@
var regFile = new RegExp(selectedLanguage.in + '\\s.*$', 'm'),
partsFile = String(regFile.exec(fileLi));

partsFile = partsFile.replace(selectedLanguage.in + ' ', '').replace(':' + partsLine, '');
partsFile = partsFile.replace(selectedLanguage.in + ' ', '').replace(':' + partsLine, '').replace('<---', '');

li = li.replace(partsFrame, '<span class="' + this.settings.frame + '">' + newPartsFrame + '</span>')
.replace(partsFile, '<span class="' + this.settings.file + '">' + partsFile + '</span>')
Expand Down
4 changes: 2 additions & 2 deletions test/stacktraces.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
<pre><code class="stacktrace-ru">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</code></pre>
<pre><code class="stacktrace-cn">System.Exception: Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. 系统找不到指定的文件。 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在 ClrCustomVisualizerVSHost.VisualizerTargetInternal.&lt;RequestDataAsync&gt;d__10.MoveNext() --- 引发异常的上一位置中堆栈跟踪的末尾 --- 在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 在 Microsoft.VisualStudio.OutOfProcessVisualizers.VisualizerTarget.&lt;RequestDataAsync&gt;d__10.MoveNext()</code></pre>

<pre><code class="stacktrace-bug">Azure.Messaging.ServiceBus.ServiceBusException: The lock supplied is invalid. Either the lock expired, or the message has already been removed from the queue, or was received by a different receiver instance. (MessageLockLost). For troubleshooting information, see https://aka.ms/azsdk/net/servicebus/exceptions/troubleshoot.
at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.ThrowLockLostException() at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.DisposeMessageAsync(Guid lockToken, Outcome outcome, TimeSpan timeout) at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.CompleteInternalAsync(Guid lockToken, TimeSpan timeout) at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.&lt;&gt;c.&lt;&lt;CompleteAsync&gt;b__43_0>d.MoveNext() --- End of stack trace from previous location --- at Azure.Messaging.ServiceBus.ServiceBusRetryPolicy.&lt;&gt;c__22`1.&lt;&lt;RunOperation&gt;b__22_0&gt;d.MoveNext() --- End of stack trace from previous location --- at Azure.Messaging.ServiceBus.ServiceBusRetryPolicy.RunOperation[T1,TResult](Func`4 operation, T1 t1, TransportConnectionScope scope, CancellationToken cancellationToken, Boolean logRetriesAsVerbose) at Azure.Messaging.ServiceBus.ServiceBusRetryPolicy.RunOperation[T1](Func`4 operation, T1 t1, TransportConnectionScope scope, CancellationToken cancellationToken) at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.CompleteAsync(Guid lockToken, CancellationToken cancellationToken) at Azure.Messaging.ServiceBus.ServiceBusReceiver.CompleteMessageAsync(ServiceBusReceivedMessage message, CancellationToken cancellationToken) at Azure.Messaging.ServiceBus.ReceiverManager.ProcessOneMessage(ServiceBusReceivedMessage triggerMessage, CancellationToken cancellationToken)</code></pre>
<pre><code class="stacktrace-bug">Azure.Messaging.ServiceBus.ServiceBusException: The lock supplied is invalid. Either the lock expired, or the message has already been removed from the queue, or was received by a different receiver instance. (MessageLockLost). For troubleshooting information, see https://aka.ms/azsdk/net/servicebus/exceptions/troubleshoot. at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.ThrowLockLostException() at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.DisposeMessageAsync(Guid lockToken, Outcome outcome, TimeSpan timeout) at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.CompleteInternalAsync(Guid lockToken, TimeSpan timeout) at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.&lt;&gt;c.&lt;&lt;CompleteAsync&gt;b__43_0>d.MoveNext() --- End of stack trace from previous location --- at Azure.Messaging.ServiceBus.ServiceBusRetryPolicy.&lt;&gt;c__22`1.&lt;&lt;RunOperation&gt;b__22_0&gt;d.MoveNext() --- End of stack trace from previous location --- at Azure.Messaging.ServiceBus.ServiceBusRetryPolicy.RunOperation[T1,TResult](Func`4 operation, T1 t1, TransportConnectionScope scope, CancellationToken cancellationToken, Boolean logRetriesAsVerbose) at Azure.Messaging.ServiceBus.ServiceBusRetryPolicy.RunOperation[T1](Func`4 operation, T1 t1, TransportConnectionScope scope, CancellationToken cancellationToken) at Azure.Messaging.ServiceBus.Amqp.AmqpReceiver.CompleteAsync(Guid lockToken, CancellationToken cancellationToken) at Azure.Messaging.ServiceBus.ServiceBusReceiver.CompleteMessageAsync(ServiceBusReceivedMessage message, CancellationToken cancellationToken) at Azure.Messaging.ServiceBus.ReceiverManager.ProcessOneMessage(ServiceBusReceivedMessage triggerMessage, CancellationToken cancellationToken)</code></pre>
<pre><code class="stacktrace-ultimate">System.AggregateException: One or more errors occurred. (One of the identified items was in an invalid format.) (Object reference not set to an instance of an object.) ---&gt; System.FormatException: One of the identified items was in an invalid format. at ConsoleApp.A.X() in C:\projects\ConsoleApp\A.cs:line 13 at Program.&lt;&gt;c.&lt;&lt;Main&gt;Program.&lt;&gt;c.&lt;&lt;Main&gt;Program.&lt;&gt;c.&lt;&lt;Main&gt;$&gt;b__0_0()gt;b__0_0gt;b__0_0() in C:\projects\ConsoleApp\Program.cs:line 12 at Program.&lt;&lt;Main&gt;Program.&lt;&lt;Main&gt;Program.&lt;&lt;Main&gt;$&gt;g__CaptureException|0_1(Action action)gt;g__CaptureException|0_1gt;g__CaptureException|0_1(Action action) in C:\projects\ConsoleApp\Program.cs:line 45 --- End of stack trace from previous location --- at Program.&lt;Main&gt;$(String[] args) in C:\projects\ConsoleApp\Program.cs:line 11 --- End of inner exception stack trace --- ---&gt; (Inner Exception #1) System.NullReferenceException: Object reference not set to an instance of an object. at ConsoleApp.B.Y() in C:\projects\ConsoleApp\A.cs:line 21 at Program.&lt;Main&gt;$(String[] args) in C:\projects\ConsoleApp\Program.cs:line 22&lt;---</code></pre>

</body>
</html>
Loading

0 comments on commit 71df3ba

Please sign in to comment.