Exceptions

Catch

try
{
    // do something
}
catch (Exception e)
{
    logger.Error("Cannot create folder", e);
}

User Defined Exceptions

…for most applications, derive custom exceptions from the ApplicationException class:

using System;

public class EmployeeListNotFoundException : ApplicationException
{
    public EmployeeListNotFoundException()
    {
    }

    public EmployeeListNotFoundException(string message)
        :   base(message)
    {
    }

    public EmployeeListNotFoundException(string message, Exception inner)
        :   base(message, inner)
    {
    }
}