Skip to content
Permalink
Browse files

Log error details when /updates fails. (also make reports code a tiny…

… bit nicer)
  • Loading branch information...
UnknownShadow200 committed Jul 1, 2017
1 parent c461ff0 commit 1617f8b3e0650e4d0d6040b41b850a46f2aff143
Showing with 6 additions and 5 deletions.
  1. +1 −1 fCraft/Commands/MaintenanceCommands.cs
  2. +5 −4 fCraft/Player/Report.cs
@@ -1399,7 +1399,7 @@ static void SaveHandler(Player player, CommandReader cmd)
player.Message("ProCraft.zip last update (&7" + zipTime.ToMiniString() + " &Sago):");
player.Message(" &7" + latest.ToLongDateString() + " &Sat &7" + latest.ToLongTimeString());
} catch (Exception ex) {
Logger.Log(LogType.Debug, ex.ToString());
Logger.Log(LogType.Error, "Updates.UpdaterHandler:" + ex);
player.Message("Cannot access http://123dmwm.tk/ at the moment.");
}
player.Message("Server file last update (&7" + currentTime.ToMiniString() + " &Sago):");
@@ -18,6 +18,9 @@ public class Report {
/// <summary> The report message. </summary>
public string Message;

/// <summary> Path to the report file on disc. </summary>
public string FilePath { get { return "./Reports/" + Id + "-" + Sender + ".txt"; } }

public static List<Report> Reports = new List<Report>();


@@ -34,9 +37,7 @@ public class Report {
/// <summary> Completely removes the report and data of it. </summary>
public void RemoveReport() {
Reports.Remove(this);
if (File.Exists("./Reports/" + Id + "-" + Sender + ".txt")) {
File.Delete("./Reports/" + Id + "-" + Sender + ".txt");
}
if (File.Exists(FilePath)) File.Delete(FilePath);
}


@@ -48,7 +49,7 @@ public class Report {
if (!Directory.Exists("./Reports")) {
Directory.CreateDirectory("./Reports");
}
File.WriteAllLines("./Reports/" + report.Id + "-" + report.Sender + ".txt", data);
File.WriteAllLines(report.FilePath, data);
} catch (Exception ex) {
Logger.Log(LogType.Error, "Report.SaveReport: " + ex);
}

0 comments on commit 1617f8b

Please sign in to comment.
You can’t perform that action at this time.