handle an exception