I need to distinguish between sybase exception types based on range of error codes .
Basically I need to distinguish between sybase system related exceptions and data exceptions .
I have c# code to handle sybase database exception .
We get error codes in exception but I don't know the range which defines that the error code is sybase system exception and not data exception .
I need to handle both this exceptions in different way .
Can some one please help on this .
Copying the code below .
using System.Data.Common;
int Range1 = 0;
int Range2 = 2000;
try
{
// Sybase data base operation
}
catch (DbException e)
{
// Sybase system exception like database space not availabe , Time out error
if(e.ErrorCode > Range1 && e.ErrorCode< Range2)
{
// This is system excpetion so dump the data to be reprocessed after database is up .
}
// Excpetions like referential integrity violation , value is more than max length
else
{
// This is data releted exception so Don't process this data again as the data itself is wrong
}
}