public AcError(AcCommonObject target, AcErrorType type, params object[] args) {
Target = target;
Type = type;
Category = CategoryFromType(type);
try {
Message = string.Format(MessageFromType(type), args.Select(x => (x as Exception)?.Message ?? x).ToArray());
} catch (FormatException) {
Message = Regex.Replace(MessageFromType(type), @"\{\d+\}", "?");
}
BaseException = args.OfType<Exception>().FirstOrDefault();
if (Category != AcErrorCategory.CarSkin &&
(type != AcErrorType.Data_JsonIsMissing || !Equals(args.FirstOrDefault(), @"ui_skin.json"))) {
Logging.Write(Message);
}
foreach (var exception in args.OfType<Exception>()) {
Logging.Warning(exception);
}
}