config add exception when config file is not found
This commit is contained in:
parent
7634b7f655
commit
607b347dd5
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
|
||||||
namespace SparkleLib {
|
namespace SparkleLib {
|
||||||
|
@ -30,6 +31,9 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public SparkleConfig (string path)
|
public SparkleConfig (string path)
|
||||||
{
|
{
|
||||||
|
if (!File.Exists (path))
|
||||||
|
throw new ConfigFileNotFoundException (path + " does not exist");
|
||||||
|
|
||||||
Path = path;
|
Path = path;
|
||||||
Load (Path);
|
Load (Path);
|
||||||
}
|
}
|
||||||
|
@ -95,4 +99,11 @@ namespace SparkleLib {
|
||||||
Save (Path);
|
Save (Path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
public class ConfigFileNotFoundException : Exception {
|
||||||
|
|
||||||
|
public ConfigFileNotFoundException (string message)
|
||||||
|
: base (message) { }
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue