Improve error log on resource import failure.

This commit is contained in:
2023-03-17 18:00:46 +08:00
parent 5b727065f3
commit d280d27a0a

View File

@@ -157,7 +157,7 @@ namespace Cryville.Crtr.Browsing {
resources = converter.ConvertFrom(file);
}
catch (Exception ex) {
LogAndPopup(4, ex.Message);
LogAndPopupExtra(4, ex, "Failed to import resource: {0}", ex.Message);
return false;
}
foreach (var res in resources) {
@@ -220,6 +220,12 @@ namespace Cryville.Crtr.Browsing {
Popup.Create(msg);
}
void LogAndPopupExtra(int level, object extraLog, string format, params object[] args) {
var msg = string.Format(format, args);
Logger.Log("main", level, "Resource", "{0}\n{1}", msg, extraLog);
Popup.Create(msg);
}
public string[] GetSupportedFormats() {
return converters.Keys.ToArray();
}