Universal exceptions to avoid creating your own
GenericExceptions is a lightweight .NET library developed to solve a common problem. You don't need to implement exceptions anymore. You already have all possible exceptions.
It can be used with existing error codes or new ones.
public enum ResultCode
{
Undefined = 0,
Success = 1,
Error = -1
}
//...
try
{
throw GenericException.Create(ResultCode.Error);
}
catch (GenericException<ResultCode> exception)
{
Debug.WriteLine(exception.First);
exception.Throw();
}
Create any exceptions that You can think of and catch them.
try
{
throw GenericException.Create(DayOfWeek.Friday, @"Can't work!");
}
catch (GenericException exception)
{
Debug.WriteLine(exception);
exception.Throw();
}
Copyright (c) c0debeef@gmail.com. See LICENSE for details.