diff --git a/src/Lurker/ClientLurker.cs b/src/Lurker/ClientLurker.cs
index 6dbcdeee..be1609d2 100644
--- a/src/Lurker/ClientLurker.cs
+++ b/src/Lurker/ClientLurker.cs
@@ -436,10 +436,13 @@ private void OnFileChanged(string newline)
}
catch (Exception ex)
{
- var exception = new Exception($"Line in error: {newline}", ex);
+ var lineError = $"Line in error: {newline}";
+ var exception = new Exception(lineError, ex);
Logger.Error(exception, exception.Message);
+
#if (!DEBUG)
- SentrySdk.CaptureException(exception);
+ SentrySdk.AddBreadcrumb(message: lineError, level: BreadcrumbLevel.Error);
+ SentrySdk.CaptureException(ex);
#endif
}
}
diff --git a/src/Lurker/Events/TradeEvent.cs b/src/Lurker/Events/TradeEvent.cs
index 738c4c78..677670c1 100644
--- a/src/Lurker/Events/TradeEvent.cs
+++ b/src/Lurker/Events/TradeEvent.cs
@@ -155,48 +155,55 @@ public static bool IsTradeMessage(string message)
/// The item location
public Location ParseLocation(string locationValue)
{
- var locationMarkerIndex = locationValue.IndexOf(LocationMarker);
- var locationMarkerEndIndex = locationValue.IndexOf(LocationMarkerEnd);
- if (locationMarkerIndex == -1 || locationMarkerEndIndex == -1)
+ try
{
- return new Location();
- }
+ var locationMarkerIndex = locationValue.IndexOf(LocationMarker);
+ var locationMarkerEndIndex = locationValue.IndexOf(LocationMarkerEnd);
+ if (locationMarkerIndex == -1 || locationMarkerEndIndex == -1)
+ {
+ return new Location();
+ }
- // tab name
- var tabValue = locationValue.GetLineBefore("\";");
- var index = tabValue.IndexOf("\"");
- var stashTabName = tabValue.Substring(index + 1);
+ // tab name
+ var tabValue = locationValue.GetLineBefore("\";");
+ var index = tabValue.IndexOf("\"");
+ var stashTabName = tabValue.Substring(index + 1);
- // Position
- var positionValue = locationValue.GetLineAfter("\";");
- var positionIndex = positionValue.IndexOf(PositionMarker);
+ // Position
+ var positionValue = locationValue.GetLineAfter("\";");
+ var positionIndex = positionValue.IndexOf(PositionMarker);
- if (positionIndex != -1)
- {
- positionValue = positionValue.GetLineAfter("position: ");
- }
+ if (positionIndex != -1)
+ {
+ positionValue = positionValue.GetLineAfter("position: ");
+ }
- var positions = positionValue.Split(", ");
- var leftValue = positions[0].GetLineAfter("left ");
- var topValue = positions[1].GetLineAfter("top ");
+ var positions = positionValue.Split(", ");
+ var leftValue = positions[0].GetLineAfter("left ");
+ var topValue = positions[1].GetLineAfter("top ");
+
+ if (string.IsNullOrEmpty(leftValue) || string.IsNullOrEmpty(topValue))
+ {
+ return new Location()
+ {
+ StashTabName = stashTabName
+ };
+ }
+
+ var closingMarkerIndex = topValue.IndexOf(")");
+ topValue = topValue.Substring(0, closingMarkerIndex);
- if (string.IsNullOrEmpty(leftValue) || string.IsNullOrEmpty(topValue))
- {
return new Location()
{
- StashTabName = stashTabName
+ StashTabName = stashTabName,
+ Left = Convert.ToInt32(leftValue),
+ Top = Convert.ToInt32(topValue),
};
}
-
- var closingMarkerIndex = topValue.IndexOf(")");
- topValue = topValue.Substring(0, closingMarkerIndex);
-
- return new Location()
+ catch
{
- StashTabName = stashTabName,
- Left = Convert.ToInt32(leftValue),
- Top = Convert.ToInt32(topValue),
- };
+ return new Location();
+ }
}
///
@@ -206,19 +213,26 @@ public Location ParseLocation(string locationValue)
/// The price of the offer.
public Price ParsePrice(string priceValue)
{
- var values = priceValue.Split(' ');
- if (!double.TryParse(values[0], out _))
+ try
{
- return new Price();
- }
+ var values = priceValue.Split(' ');
+ if (!double.TryParse(values[0], out _))
+ {
+ return new Price();
+ }
- var currencyTypeValue = string.Join(" ", values.Skip(1));
+ var currencyTypeValue = string.Join(" ", values.Skip(1));
- return new Price()
+ return new Price()
+ {
+ NumberOfCurrencies = double.Parse(values[0], CultureInfo.InvariantCulture),
+ CurrencyType = CurrencyTypeParser.Parse(currencyTypeValue),
+ };
+ }
+ catch
{
- NumberOfCurrencies = double.Parse(values[0], CultureInfo.InvariantCulture),
- CurrencyType = CurrencyTypeParser.Parse(currencyTypeValue),
- };
+ return new Price();
+ }
}
///