In msdn link, it is mentioned that
Do not throw System.Exception or System.SystemException.
In my code i am throwing like this
private MsgShortCode GetshortMsgCode(string str)
{
switch (str.Replace(" ","").ToUpper())
{
case "QNXC00":
return MsgShortCode.QNXC00;
default:
throw new Exception("Invalid message code received");
}
}
is this a bad practice??
Generally you can be more explicit.
In this case, you can throw a
The more specific you are, the easier it is for other code to handle the exception.
This allows you to do