blob: 7a57681e71681ccf801dfe5acbacabeb94f91e5e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Tango.FSE.Procedures.Helpers
{
public static class ProcedureExceptionHelper
{
public static int? GetExceptionLineNumber(Exception ex, ProcedureProject project)
{
try
{
Regex regex = new Regex(@"OnExecute\(IProcedureContext context\) in :line (\d+)");
var matches = regex.Matches(ex.ToString()).OfType<Match>().ToList();
if (matches.Count > 0)
{
var match = matches.First();
if (match.Groups.Count > 1)
{
var line = match.Groups[1].Value;
int lineNumber = int.Parse(line) - project.Scripts.Count + 1;
return lineNumber;
}
}
}
catch { }
return null;
}
}
}
|