Throw exceptions on unknown Service or Tool
This commit is contained in:
parent
65d027179c
commit
ab217c9052
@ -15,7 +15,7 @@ public class ReaderFactory
|
||||
{
|
||||
"Guess" => (IReader)_serviceProvider.GetService(typeof(GuessReader)),
|
||||
"Excel" => (IReader)_serviceProvider.GetService(typeof(ExcelReader)),
|
||||
_ => (IReader)_serviceProvider.GetService(typeof(ExcelReader))
|
||||
_ => throw new ArgumentException($"Незвестный интерфейс {nameof(IReader)}: {readerName}")
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class WriterFactory
|
||||
{
|
||||
"Excel" => (IWriter)_serviceProvider.GetService(typeof(ExcelWriter)),
|
||||
"Dxf" => (IWriter)_serviceProvider.GetService(typeof(DxfWriter)),
|
||||
_ => (IWriter)_serviceProvider.GetService(typeof(ExcelWriter))
|
||||
_ => throw new ArgumentException($"Незвестный интерфейс {nameof(IWriter)}: {writerName}")
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ internal class ToolFactory
|
||||
"merge" => new MergeTool(RhSolutionsAddIn.ServiceProvider),
|
||||
"dxfexport" => new DxfTool(RhSolutionsAddIn.ServiceProvider),
|
||||
"Guessexport" => new GuessTool(RhSolutionsAddIn.ServiceProvider),
|
||||
_ => throw new Exception("Неизвестный инструмент"),
|
||||
_ => throw new Exception($"Неизвестный инструмент {toolName}"),
|
||||
};
|
||||
return tool;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user