Skip to content

Commit db3059a

Browse files
committed
Report well-formedness/validation errors in WLAN profile XML
1 parent 747a7f2 commit db3059a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

modifier/Wifi.cs

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Text;
33
using System.Xml;
4+
using System.Xml.Schema;
45

56
namespace Schneegans.Unattend;
67

@@ -207,7 +208,15 @@ void AddWifiProfile(IProfileWifiSettings settings)
207208
string logfile = @"%TEMP%\wifi.log";
208209

209210
XmlDocument profile = settings.ProfileXml;
210-
Util.ValidateAgainstSchema(profile, "WLAN_profile_v1.xsd");
211+
try
212+
{
213+
Util.ValidateAgainstSchema(profile, "WLAN_profile_v1.xsd");
214+
}
215+
catch (Exception e) when (e is XmlException or XmlSchemaException)
216+
{
217+
throw new ConfigurationException($"WLAN profile XML is invalid: {e.Message}");
218+
}
219+
211220
AddXmlFile(profile, xmlfile);
212221

213222
CommandAppender appender = GetAppender(CommandConfig.Specialize);

0 commit comments

Comments
 (0)