adds error and exception handlers