The CountryHawkException represents an exception thrown when CountryHawk encounters an invalid argument. The invalid argument can be one that is passed in to one of its methods, or one that it encounters internally such as if a data file contains an invalid country code. The Message property of the exception will contain specific details about the problem encountered.
VB.NET Example:
dim chObj as CountryObj
dim errMsg as string
Try
chObj = CountryObj.GetCountry("212.12.15.30")
Response.Write("Country code is: " + chObj.CountryCode)
Catch e As InvalidArgException
errMsg = "An invalid arg was passed. Details: " + e.Message
Response.Write(errMsg)
Catch e As CountryHawkException
errMsg = "A general CountryHawk error occurred. Details: " + e.Message
Response.Write(errMsg)
End Try
C# Example:
CountryObj chObj;
string errMsg;
try {
chObj = CountryObj.GetCountry("212.12.15.30");
Response.Write("Country code is: " + chObj.CountryCode);
}
catch (InvalidArgException e)
{
errMsg = "An invalid arg was passed. Details: " + e.Message;
Response.Write(errMsg);
}
catch (CountryHawkException e)
{
errMsg = "A general CountryHawk error occurred. Details: " + e.Message;
Response.Write(errMsg);
}