CountryHawkException (.NET)

 

The CountryHawkException represents an exception thrown when CountryHawk encounters an unexpected problem, such as a missing data file or corrupt data file, invalid permissions, invalid or expired license, etc. 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);

}