What exception type to throw for unrecognized ID paramater?
Posted
by fearofawhackplanet
on Stack Overflow
See other posts from Stack Overflow
or by fearofawhackplanet
Published on 2010-04-14T16:16:45Z
Indexed on
2010/04/14
16:23 UTC
Read the original article
Hit count: 286
ITool GetTool(Guid tool)
{
if (tool = Hammer.Id)
return new Hammer();
else if (tool = Drill.Id)
return new Drill();
else
throw new ....?
}
What's the most appropriate exception type to throw here? NotSupportedException is the closest I've found but I don't think that's quite right.
© Stack Overflow or respective owner