Skip to content

Commit 1617f8b

Browse files
Log error details when /updates fails. (also make reports code a tiny bit nicer)
1 parent c461ff0 commit 1617f8b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

fCraft/Commands/MaintenanceCommands.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ static void UpdatesHandler(Player player, CommandReader cmd) {
13991399
player.Message("ProCraft.zip last update (&7" + zipTime.ToMiniString() + " &Sago):");
14001400
player.Message(" &7" + latest.ToLongDateString() + " &Sat &7" + latest.ToLongTimeString());
14011401
} catch (Exception ex) {
1402-
Logger.Log(LogType.Debug, ex.ToString());
1402+
Logger.Log(LogType.Error, "Updates.UpdaterHandler:" + ex);
14031403
player.Message("Cannot access http://123dmwm.tk/ at the moment.");
14041404
}
14051405
player.Message("Server file last update (&7" + currentTime.ToMiniString() + " &Sago):");

fCraft/Player/Report.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ public class Report {
1818
/// <summary> The report message. </summary>
1919
public string Message;
2020

21+
/// <summary> Path to the report file on disc. </summary>
22+
public string FilePath { get { return "./Reports/" + Id + "-" + Sender + ".txt"; } }
23+
2124
public static List<Report> Reports = new List<Report>();
2225

2326

@@ -34,9 +37,7 @@ public void AddReport(int id, string sender, DateTime datesent, string message)
3437
/// <summary> Completely removes the report and data of it. </summary>
3538
public void RemoveReport() {
3639
Reports.Remove(this);
37-
if (File.Exists("./Reports/" + Id + "-" + Sender + ".txt")) {
38-
File.Delete("./Reports/" + Id + "-" + Sender + ".txt");
39-
}
40+
if (File.Exists(FilePath)) File.Delete(FilePath);
4041
}
4142

4243

@@ -48,7 +49,7 @@ public static void SaveReport(Report report) {
4849
if (!Directory.Exists("./Reports")) {
4950
Directory.CreateDirectory("./Reports");
5051
}
51-
File.WriteAllLines("./Reports/" + report.Id + "-" + report.Sender + ".txt", data);
52+
File.WriteAllLines(report.FilePath, data);
5253
} catch (Exception ex) {
5354
Logger.Log(LogType.Error, "Report.SaveReport: " + ex);
5455
}

0 commit comments

Comments
 (0)