Skip to content

Commit 0323980

Browse files
invalid filter string exception catch
1 parent 602475d commit 0323980

1 file changed

Lines changed: 24 additions & 5 deletions

File tree

XIC/XicReader.cs

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,9 @@ public static void ReadXic(string rawFilePath, bool base64, XicData xicData)
118118

119119
if (rtFilteredScans.Count != 0)
120120
{
121-
data = rawFile.GetChromatogramData(new IChromatogramSettings[] {settings},
122-
rtFilteredScans[0],
121+
data = GetChromatogramData(rawFile, settings, rtFilteredScans[0],
123122
rtFilteredScans[rtFilteredScans.Count - 1]);
124-
if (data.PositionsArray.Length == 1 && data.PositionsArray[0].Length == 1 &&
123+
if (data != null && data.PositionsArray.Length == 1 && data.PositionsArray[0].Length == 1 &&
125124
(Math.Abs(data.PositionsArray[0][0] - startTime) < 0.001 ||
126125
Math.Abs(data.PositionsArray[0][0] - endTime) < 0.001))
127126
{
@@ -137,8 +136,7 @@ public static void ReadXic(string rawFilePath, bool base64, XicData xicData)
137136
}
138137
else
139138
{
140-
data = rawFile.GetChromatogramData(new IChromatogramSettings[] {settings}, firstScanNumber,
141-
lastScanNumber);
139+
data = GetChromatogramData(rawFile, settings, firstScanNumber, lastScanNumber);
142140
}
143141

144142
if (data != null)
@@ -162,6 +160,27 @@ public static void ReadXic(string rawFilePath, bool base64, XicData xicData)
162160
}
163161
}
164162

163+
private static IChromatogramData GetChromatogramData(IRawDataPlus rawFile, IChromatogramSettings settings,
164+
int firstScanNumber, int lastScanNumber)
165+
{
166+
IChromatogramData data = null;
167+
try
168+
{
169+
data = rawFile.GetChromatogramData(new IChromatogramSettings[] {settings}, firstScanNumber,
170+
lastScanNumber);
171+
}
172+
catch (InvalidFilterFormatException ex)
173+
{
174+
Log.Warn($"Invalid filter string {settings.Filter}");
175+
}
176+
catch (InvalidFilterCriteriaException ex)
177+
{
178+
Log.Warn($"Invalid filter string {settings.Filter}");
179+
}
180+
181+
return data;
182+
}
183+
165184
/// <summary>
166185
/// Convert the double array into a base64 string
167186
/// </summary>

0 commit comments

Comments
 (0)