adds exception handler