mirror of https://github.com/winsw/winsw
Extension configuration failure should be logged as fatal
parent
449110f87f
commit
641adb4e0a
|
@ -86,6 +86,11 @@ namespace winsw.Extensions
|
||||||
//TODO: Implement loading of external extensions. Current version supports internal hack
|
//TODO: Implement loading of external extensions. Current version supports internal hack
|
||||||
#region Extension load management
|
#region Extension load management
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loads extensions according to the configuration file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="logger">Logger</param>
|
||||||
|
/// <exception cref="Exception">Loading failure</exception>
|
||||||
public void LoadExtensions(IEventWriter logger)
|
public void LoadExtensions(IEventWriter logger)
|
||||||
{
|
{
|
||||||
var extensionIds = ServiceDescriptor.ExtensionIds;
|
var extensionIds = ServiceDescriptor.ExtensionIds;
|
||||||
|
@ -100,7 +105,7 @@ namespace winsw.Extensions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">Extension ID</param>
|
/// <param name="id">Extension ID</param>
|
||||||
/// <param name="logger">Logger</param>
|
/// <param name="logger">Logger</param>
|
||||||
/// <exception cref="ExtensionException">Loading failure</exception>
|
/// <exception cref="Exception">Loading failure</exception>
|
||||||
private void LoadExtension(string id, IEventWriter logger)
|
private void LoadExtension(string id, IEventWriter logger)
|
||||||
{
|
{
|
||||||
if (Extensions.ContainsKey(id))
|
if (Extensions.ContainsKey(id))
|
||||||
|
@ -120,8 +125,15 @@ namespace winsw.Extensions
|
||||||
{
|
{
|
||||||
IWinSWExtension extension = CreateExtensionInstance(descriptor.Id, descriptor.ClassName);
|
IWinSWExtension extension = CreateExtensionInstance(descriptor.Id, descriptor.ClassName);
|
||||||
extension.Descriptor = descriptor;
|
extension.Descriptor = descriptor;
|
||||||
//TODO: Handle exceptions
|
try
|
||||||
extension.Configure(ServiceDescriptor, configNode, logger);
|
{
|
||||||
|
extension.Configure(ServiceDescriptor, configNode, logger);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{ // Consider any unexpected exception as fatal
|
||||||
|
Log.Fatal("Failed to configure the extension " + id, ex);
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
Extensions.Add(id, extension);
|
Extensions.Add(id, extension);
|
||||||
logger.LogEvent("Extension loaded: "+id, EventLogEntryType.Information);
|
logger.LogEvent("Extension loaded: "+id, EventLogEntryType.Information);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue