Skip to content

Commit

Permalink
JS Error Output
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisFeline committed Nov 12, 2024
1 parent 22479e7 commit 51d2085
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Models/Stats/TemplateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ static string JSEvaluator(Match m) {
static string? JSEvaluator(string content) {
try {
return ToNStats.JSEngine.Evaluate(content).ToString();
} catch (Exception) {
} catch (Exception e) {
Logger.Error(e);
return null;
}
}
Expand Down
10 changes: 5 additions & 5 deletions Utils/LilOSC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ static float EvaluateDamage(int damage) {
string evaluated = Settings.Get.OSCDamageTemplate.GetString(true);

float result;
if (!float.TryParse(evaluated, out result)) {
Logger.Debug("Could not evaluate damage: " + evaluated);
if (string.IsNullOrEmpty(evaluated) || !float.TryParse(evaluated, out result)) {
Logger.Error("Could not evaluate damage value: " + evaluated);
result = damage;
}

Expand All @@ -263,9 +263,9 @@ static int EvaluateInterval() {
string evaluated = Settings.Get.OSCDamageIntervalTemplate.GetString(true);

float result;
if (!float.TryParse(evaluated, out result)) {
Logger.Debug("Could not evaluate interval: " + evaluated);
result = 1000;
if (string.IsNullOrEmpty(evaluated) || !float.TryParse(evaluated, out result)) {
Logger.Error("Could not evaluate damage interval: " + evaluated);
result = 500;
} else {
Logger.Debug("Result Interval: " + result);
}
Expand Down

0 comments on commit 51d2085

Please sign in to comment.