add exception handler to bash directive